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("CatModel"); CatTree = val.LoadAsset("CatTree"); AudioClip[] source = val.LoadAllAssets(); 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 CatChances; public readonly ConfigEntry ModelScale; public readonly ConfigEntry AmbientMeows; public readonly ConfigEntry SpecialCats; public readonly ConfigEntry SpecialCatChance; public readonly ConfigEntry 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("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("Visuals", "ModelScale", 1f, new ConfigDescription("Size multiplier for cats. Requires restart.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 2f), Array.Empty())); SpecialCats = cfg.Bind("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("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(0f, 1f), Array.Empty())); RescueBounty = cfg.Bind("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(0, 1000), Array.Empty())); AmbientMeows = cfg.Bind("Sounds", "AmbientMeows", true, "Cats that are set down meow softly every few minutes. Monsters can never hear them."); MigrateOldSpawnKeys(cfg); } public float[] ParseCatChances() { List list = new List(); 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 orphans = Traverse.Create((object)cfg).Property("OrphanedEntries", (object[])null).GetValue>(); 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 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 netSeed = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable netPose = new NetworkVariable((byte)2, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable netIdentity = new NetworkVariable(default(FixedString128Bytes), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable netRescued = new NetworkVariable(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 netTamed = new NetworkVariable(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(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 obj = netSeed; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnSeedChanged)); NetworkVariable obj2 = netIdentity; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Combine((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnIdentityChanged)); ApplyLooks(netSeed.Value); } public override void OnNetworkDespawn() { NetworkVariable obj = netSeed; obj.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(OnSeedChanged)); NetworkVariable obj2 = netIdentity; obj2.OnValueChanged = (OnValueChangedDelegate)(object)Delegate.Remove((Delegate?)(object)obj2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate(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(); audioSource = ((Component)this).GetComponent(); Transform obj = ((Component)this).transform.Find("Purr"); purrSource = ((obj != null) ? ((Component)obj).GetComponent() : null); scanNode = ((Component)this).GetComponentInChildren(); 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(); 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(); 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(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(); 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(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(corners); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(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(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(ref yaw, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(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(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(localCorners); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref speed, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref newGait, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2811781274u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!base.isHeld && localCorners != null && localCorners.Length >= 2) { path = localCorners; pathLocal = true; pathIndex = 1; moveSpeed = speed; gait = newGait; } } } [ClientRpc] private void ShipTeleportClientRpc(Vector3 local, float localYaw) { //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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) 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(393915311u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref local); ((FastBufferWriter)(ref val)).WriteValueSafe(ref localYaw, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 393915311u, 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) { Transform elevatorTransform = StartOfRound.Instance.elevatorTransform; ((Component)this).transform.position = elevatorTransform.TransformPoint(local); ((Component)this).transform.rotation = elevatorTransform.rotation * Quaternion.Euler(0f, localYaw, 0f); base.targetFloorPosition = ((Component)this).transform.localPosition; } } } protected override void __initializeVariables() { if (netSeed == null) { throw new Exception("CatItem.netSeed cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)netSeed).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)netSeed, "netSeed"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)netSeed); if (netPose == null) { throw new Exception("CatItem.netPose cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)netPose).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)netPose, "netPose"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)netPose); if (netIdentity == null) { throw new Exception("CatItem.netIdentity cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)netIdentity).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)netIdentity, "netIdentity"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)netIdentity); if (netRescued == null) { throw new Exception("CatItem.netRescued cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)netRescued).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)netRescued, "netRescued"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)netRescued); if (netTamed == null) { throw new Exception("CatItem.netTamed cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)netTamed).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)netTamed, "netTamed"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)netTamed); ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1054263291u, new RpcReceiveHandler(__rpc_handler_1054263291), "MeowServerRpc"); ((NetworkBehaviour)this).__registerRpc(2810453604u, new RpcReceiveHandler(__rpc_handler_2810453604), "MeowClientRpc"); ((NetworkBehaviour)this).__registerRpc(3129776640u, new RpcReceiveHandler(__rpc_handler_3129776640), "RescueServerRpc"); ((NetworkBehaviour)this).__registerRpc(1878939114u, new RpcReceiveHandler(__rpc_handler_1878939114), "RescuedClientRpc"); ((NetworkBehaviour)this).__registerRpc(2172167736u, new RpcReceiveHandler(__rpc_handler_2172167736), "MoveClientRpc"); ((NetworkBehaviour)this).__registerRpc(3896674073u, new RpcReceiveHandler(__rpc_handler_3896674073), "StopClientRpc"); ((NetworkBehaviour)this).__registerRpc(3223185232u, new RpcReceiveHandler(__rpc_handler_3223185232), "TeleportClientRpc"); ((NetworkBehaviour)this).__registerRpc(38956220u, new RpcReceiveHandler(__rpc_handler_38956220), "ArrivedInShipClientRpc"); ((NetworkBehaviour)this).__registerRpc(2811781274u, new RpcReceiveHandler(__rpc_handler_2811781274), "ShipMoveClientRpc"); ((NetworkBehaviour)this).__registerRpc(393915311u, new RpcReceiveHandler(__rpc_handler_393915311), "ShipTeleportClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_1054263291(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int clip = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clip); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).MeowServerRpc(clip); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2810453604(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int clip = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clip); float volume = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref volume, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).MeowClientRpc(clip, volume); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3129776640(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).RescueServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1878939114(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int bounty = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref bounty); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).RescuedClientRpc(bounty); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2172167736(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0066: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); Vector3[] corners = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref corners); } float speed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref speed, default(ForPrimitives)); byte newGait = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newGait, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).MoveClientRpc(corners, speed, newGait); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3896674073(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); float yaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref yaw, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).StopClientRpc(position, yaw); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3223185232(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); float yaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref yaw, default(ForPrimitives)); bool inFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref inFactory, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).TeleportClientRpc(position, yaw, inFactory); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_38956220(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).ArrivedInShipClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2811781274(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0066: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); Vector3[] localCorners = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref localCorners); } float speed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref speed, default(ForPrimitives)); byte newGait = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newGait, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).ShipMoveClientRpc(localCorners, speed, newGait); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_393915311(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 local = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref local); float localYaw = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref localYaw, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CatItem)(object)target).ShipTeleportClientRpc(local, localYaw); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "CatItem"; } } internal readonly struct CatLooks { private class SpecialCat { public string Name; public string CoatLabel; public Color Fur; public Color Eye; public string Encode() { //IL_001a: 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) return Name + "|" + ColorUtility.ToHtmlStringRGB(Fur) + "|" + ColorUtility.ToHtmlStringRGB(Eye) + "|" + CoatLabel; } } public const int SeedBits = 22; public const int SeedMask = 4194303; private static readonly (string name, Color color)[] Furs = new(string, Color)[9] { ("Ginger", new Color(0.85f, 0.45f, 0.15f)), ("Black", new Color(0.07f, 0.07f, 0.08f)), ("White", new Color(0.8f, 0.79f, 0.76f)), ("Grey", new Color(0.46f, 0.47f, 0.5f)), ("Cream", new Color(0.82f, 0.7f, 0.52f)), ("Chocolate", new Color(0.38f, 0.24f, 0.15f)), ("Silver", new Color(0.62f, 0.64f, 0.67f)), ("Blue", new Color(0.38f, 0.43f, 0.51f)), ("Fawn", new Color(0.78f, 0.62f, 0.45f)) }; private static readonly (string name, Color color)[] Eyes = new(string, Color)[6] { ("Green", new Color(0.45f, 0.8f, 0.2f)), ("Yellow", new Color(0.95f, 0.8f, 0.15f)), ("Amber", new Color(0.95f, 0.55f, 0.1f)), ("Blue", new Color(0.3f, 0.6f, 0.95f)), ("Copper", new Color(0.8f, 0.4f, 0.15f)), ("Hazel", new Color(0.6f, 0.62f, 0.25f)) }; private static readonly (string name, Color color)[] ExtraColors = new(string, Color)[2] { ("Peach", new Color(0.86f, 0.63f, 0.45f)), ("Olive", new Color(0.5f, 0.6f, 0.22f)) }; private static readonly string[] BuiltInNames = new string[58] { "Mittens", "Biscuit", "Pumpkin", "Mochi", "Noodle", "Beans", "Waffles", "Tofu", "Pepper", "Socks", "Muffin", "Ziggy", "Olive", "Gizmo", "Nugget", "Clover", "Pudding", "Sprout", "Marbles", "Toast", "Bean", "Whiskers", "Luna", "Milo", "Cleo", "Oreo", "Salem", "Tater", "Dumpling", "Scrap", "Bolt", "Quota", "Gordion", "Rivet", "Sprocket", "Fuse", "Ducky", "Apparatus", "Biscotti", "Nimbus", "Pebble", "Juniper", "Maple", "Sushi", "Paprika", "Wasabi", "Bramble", "Cosmo", "Hazel", "Fig", "Pistachio", "Turnip", "Butters", "Kiwi", "Smudge", "Tinsel", "Mabel", "Ravioli" }; private static List specials = new List(); private static string[] namePool = BuiltInNames; public readonly string Name; public readonly string FurName; public readonly Color Fur; public readonly Color Eye; public readonly float SizeRoll; public static float SizeMin = 1.15f; public static float SizeMax = 2.05f; public readonly int SoundRoll; public float Size => SizeAt(SizeRoll); public static IEnumerable SpecialNames => specials.Select((SpecialCat s) => s.Name); public static float SizeAt(float roll) { return Mathf.Lerp(SizeMin, SizeMax, roll); } public CatLooks(int seed, string identity) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(seed); (string, Color) tuple = Furs[random.Next(Furs.Length)]; FurName = tuple.Item1; Fur = tuple.Item2; Eye = Eyes[random.Next(Eyes.Length)].color; Name = BuiltInNames[random.Next(BuiltInNames.Length)]; SizeRoll = (float)random.NextDouble(); SoundRoll = random.Next(); if (string.IsNullOrEmpty(identity)) { return; } string[] array = identity.Split('|'); Name = array[0]; Color fur = default(Color); Color eye = default(Color); if (array.Length >= 3 && ColorUtility.TryParseHtmlString("#" + array[1], ref fur) && ColorUtility.TryParseHtmlString("#" + array[2], ref eye)) { Fur = fur; Eye = eye; if (array.Length >= 4 && array[3].Length > 0) { FurName = array[3]; } } } public static string ResolveIdentity(int seed) { string name = PoolName(seed); SpecialCat specialCat = specials.FirstOrDefault((SpecialCat s) => s.Name == name); if (specialCat == null) { return name; } return specialCat.Encode(); } private static string PoolName(int seed) { Random random = new Random(seed); random.Next(Furs.Length); random.Next(Eyes.Length); return namePool[random.Next(namePool.Length)]; } public static int NewSeed() { for (int i = 0; i < 1000; i++) { int seed = Random.Range(1, 4194304); if (specials.All((SpecialCat s) => s.Name != PoolName(seed))) { return seed; } } return Random.Range(1, 4194304); } public static int SeedFor(string specialName) { for (int i = 0; i < 100000; i++) { int num = Random.Range(1, 4194304); if (PoolName(num) == specialName) { return num; } } return 0; } public static void LoadSpecials(string config) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) specials = new List(); string[] array = (config ?? "").Split(';'); foreach (string text in array) { string[] f = (from s in text.Split(',') select s.Trim()).ToArray(); if (f.Length < 3 || f[0].Length == 0) { continue; } if (f[0].Contains("|") || !TryColor(f[1], eye: false, out var c) || !TryColor(f[2], eye: true, out var c2)) { Plugin.Log.LogWarning((object)("Couldn't read special cat '" + text.Trim() + "'. Expected: Name, FurColour, EyeColour[, CoatLabel]")); continue; } string text2 = ((f.Length >= 4 && f[3].Length > 0) ? f[3] : (f[1].StartsWith("#") ? "Special" : f[1])); specials.RemoveAll((SpecialCat s) => s.Name == f[0]); specials.Add(new SpecialCat { Name = f[0], Fur = c, Eye = c2, CoatLabel = text2.Replace("|", "") }); } namePool = BuiltInNames.Where((string n) => specials.All((SpecialCat s) => s.Name != n)).Concat(specials.Select((SpecialCat s) => s.Name)).ToArray(); Plugin.Log.LogInfo((object)("Special cats: " + ((specials.Count == 0) ? "none" : string.Join(", ", specials.Select((SpecialCat s) => s.Name))))); } private static bool TryColor(string s, bool eye, out Color c) { //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (s.StartsWith("#")) { return ColorUtility.TryParseHtmlString(s, ref c); } foreach (var (a, val) in (eye ? Eyes.Concat(Furs) : Furs.Concat(Eyes)).Concat(ExtraColors)) { if (string.Equals(a, s, StringComparison.OrdinalIgnoreCase)) { c = val; return true; } } c = default(Color); return false; } } internal static class CatRegistry { public static Item CatItemDef; public static GameObject Prefab; public static Item[] SoundSources = (Item[])(object)new Item[0]; private static readonly string[] SoftItemNames = new string[1] { "Soccer ball" }; private const int PropsLayer = 6; private const int ScanNodeLayer = 22; public static void Register() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.Cfg.ModelScale.Value; Prefab = NetworkPrefabs.CreateNetworkPrefab("CozyCat"); Prefab.GetComponent().AutoObjectParentSync = false; Prefab.tag = "PhysicsProp"; Prefab.layer = 6; GameObject obj = Object.Instantiate(CatAssets.CatModel, Prefab.transform); ((Object)obj).name = "Model"; obj.transform.localScale = Vector3.one * value; obj.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); Transform[] componentsInChildren = obj.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = 6; } BoxCollider obj2 = Prefab.AddComponent(); obj2.center = new Vector3(0f, 0.2f, 0f) * value; obj2.size = new Vector3(0.25f, 0.4f, 0.5f) * value; AudioSource obj3 = Prefab.AddComponent(); obj3.playOnAwake = false; obj3.spatialBlend = 1f; obj3.rolloffMode = (AudioRolloffMode)1; obj3.minDistance = 1f; obj3.maxDistance = 15f; GameObject val = new GameObject("Purr"); val.transform.SetParent(Prefab.transform, false); AudioSource obj4 = val.AddComponent(); obj4.playOnAwake = false; obj4.loop = true; obj4.volume = 0f; obj4.spatialBlend = 1f; obj4.rolloffMode = (AudioRolloffMode)1; obj4.minDistance = 0.5f; obj4.maxDistance = 5f; GameObject val2 = new GameObject("ScanNode") { layer = 22 }; val2.transform.SetParent(Prefab.transform, false); val2.transform.localPosition = new Vector3(0f, 0.3f, 0f) * value; BoxCollider obj5 = val2.AddComponent(); ((Collider)obj5).isTrigger = true; obj5.size = Vector3.one * 0.5f; ScanNodeProperties obj6 = val2.AddComponent(); obj6.maxRange = 13; obj6.minRange = 1; obj6.requiresLineOfSight = true; obj6.headerText = "Cat"; obj6.subText = "Not for sale"; obj6.nodeType = 0; Item val3 = ScriptableObject.CreateInstance(); ((Object)val3).name = "CozyCatItem"; val3.itemName = "Cat"; val3.spawnPrefab = Prefab; val3.isScrap = false; val3.minValue = (val3.maxValue = 0); val3.creditsWorth = 0; val3.weight = 1.08f; val3.twoHanded = true; val3.twoHandedAnimation = true; val3.canBeGrabbedBeforeGameStart = true; val3.itemSpawnsOnGround = true; val3.requiresBattery = false; val3.saveItemVariable = true; val3.syncUseFunction = false; val3.isConductiveMetal = false; val3.canBeInspected = false; val3.restingRotation = Vector3.zero; val3.verticalOffset = 0f; val3.positionOffset = Vector3.zero; val3.rotationOffset = Vector3.zero; val3.toolTips = ((CatAssets.Meows.Length == 0) ? new string[0] : new string[1] { "Meow : [LMB]" }); val3.meshVariants = (Mesh[])(object)new Mesh[0]; val3.materialVariants = (Material[])(object)new Material[0]; val3.clinkAudios = (AudioClip[])(object)new AudioClip[0]; CatItemDef = val3; CatItem catItem = Prefab.AddComponent(); ((GrabbableObject)catItem).itemProperties = val3; ((GrabbableObject)catItem).grabbable = true; ((GrabbableObject)catItem).grabbableToEnemies = false; Items.RegisterItem(val3); } public static void FixupFromGame(StartOfRound sor) { List items = sor.allItemsList.itemsList; Item val = ((IEnumerable)items).FirstOrDefault((Func)((Item i) => (Object)(object)i != (Object)null && i.isScrap && i.twoHanded && i.twoHandedAnimation && !string.IsNullOrEmpty(i.grabAnim))) ?? ((IEnumerable)items).FirstOrDefault((Func)((Item i) => (Object)(object)i != (Object)null && i.twoHanded)); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"No two-handed template item found; cat will use default hold animation."); return; } Item catItemDef = CatItemDef; catItemDef.grabAnim = val.grabAnim; catItemDef.grabAnimationTime = val.grabAnimationTime; Item val2 = catItemDef; if (val2.itemIcon == null) { val2.itemIcon = val.itemIcon; } SoundSources = (from n in SoftItemNames select ((IEnumerable)items).FirstOrDefault((Func)((Item i) => (Object)(object)i != (Object)null && i.itemName == n && (Object)(object)i.dropSFX != (Object)null)) into i where (Object)(object)i != (Object)null select i).ToArray(); catItemDef.grabSFX = null; catItemDef.dropSFX = null; catItemDef.pocketSFX = null; Plugin.Log.LogInfo((object)("Cat sound sources: " + string.Join(", ", SoundSources.Select((Item i) => i.itemName)))); AudioSource val3 = (((Object)(object)val.spawnPrefab != (Object)null) ? val.spawnPrefab.GetComponent() : null); if ((Object)(object)val3 != (Object)null) { AudioSource[] componentsInChildren = Prefab.GetComponentsInChildren(true); for (int num = 0; num < componentsInChildren.Length; num++) { componentsInChildren[num].outputAudioMixerGroup = val3.outputAudioMixerGroup; } } Plugin.Log.LogInfo((object)("Cat hold animation borrowed from '" + val.itemName + "' (" + val.grabAnim + ")")); } } [HarmonyPatch] public class CatTree : PerchHost { public const int Price = 50; private const int PlaceableLayer = 26; public static UnlockableItem Unlockable; public static GameObject Prefab; private static Shader litShader; private static readonly Dictionary litMats = new Dictionary(); public override string Label => "cat tree"; public static void Register() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_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_0085: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CatAssets.CatTree == (Object)null) { Plugin.Log.LogWarning((object)"Cat tree missing from the asset bundle; it won't be in the store."); return; } Prefab = NetworkPrefabs.CreateNetworkPrefab("CozyCatTree"); GameObject obj = Object.Instantiate(CatAssets.CatTree, Prefab.transform); ((Object)obj).name = "Tree"; MeshFilter componentInChildren = obj.GetComponentInChildren(); ((Component)componentInChildren).gameObject.AddComponent().sharedMesh = componentInChildren.sharedMesh; Bounds bounds = ((Renderer)((Component)componentInChildren).GetComponent()).bounds; GameObject val = new GameObject("PlacementCollider") { layer = 26, tag = "PlaceableObject" }; val.transform.SetParent(Prefab.transform, false); val.transform.localPosition = new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).extents.y, ((Bounds)(ref bounds)).center.z); BoxCollider val2 = val.AddComponent(); val2.size = ((Bounds)(ref bounds)).size; AudioSource obj2 = val.AddComponent(); obj2.playOnAwake = false; obj2.spatialBlend = 1f; AutoParentToShip val3 = Prefab.AddComponent(); val3.overrideOffset = true; PlaceableShipObject obj3 = val.AddComponent(); obj3.parentObject = val3; obj3.mainMesh = componentInChildren; obj3.mainTransform = Prefab.transform; obj3.placeObjectCollider = (Collider)(object)val2; obj3.yOffset = ((Bounds)(ref bounds)).extents.y; obj3.AllowPlacementOnCounters = false; obj3.AllowPlacementOnWalls = false; Prefab.AddComponent(); TerminalNode val4 = ScriptableObject.CreateInstance(); val4.clearPreviousText = true; val4.displayText = "A big carpeted cat tree with a hideaway, a hammock and a lookout on top. Cats living on the ship will wander over and nap in it.\n\nMove it with [B] like any furniture.\n\n"; Unlockable = new UnlockableItem { unlockableName = "Cat tree", prefabObject = Prefab, unlockableType = 1, IsPlaceable = true, spawnPrefab = true, alwaysInStock = true, canBeStored = true, maxNumber = 1 }; Unlockables.RegisterUnlockable(Unlockable, (StoreType)1, (TerminalNode)null, (TerminalNode)null, val4, 50); Plugin.Log.LogInfo((object)$"Cat tree registered (${50}), {((Bounds)(ref bounds)).size.x:0.00} x {((Bounds)(ref bounds)).size.y:0.00} x {((Bounds)(ref bounds)).size.z:0.00} m"); } public static void FixupFromGame(StartOfRound sor) { if (!((Object)(object)Prefab == (Object)null)) { AudioClip placeObjectSFX = sor.unlockablesList.unlockables.Select((UnlockableItem u) => (!((Object)(object)u.prefabObject != (Object)null)) ? null : u.prefabObject.GetComponentInChildren()).FirstOrDefault((Func)((PlaceableShipObject p) => (Object)(object)p != (Object)null && (Object)(object)p.placeObjectSFX != (Object)null))?.placeObjectSFX ?? ((IEnumerable)Object.FindObjectsOfType()).FirstOrDefault((Func)((PlaceableShipObject p) => (Object)(object)p.placeObjectSFX != (Object)null))?.placeObjectSFX; PlaceableShipObject componentInChildren = Prefab.GetComponentInChildren(); componentInChildren.placeObjectSFX = placeObjectSFX; AudioSource component = ((Component)componentInChildren).GetComponent(); AudioMixerGroup val = (((Object)(object)sor.shipAmbianceAudio != (Object)null) ? sor.shipAmbianceAudio.outputAudioMixerGroup : null); if ((Object)(object)val != (Object)null) { component.outputAudioMixerGroup = val; } } } private void Awake() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).hideFlags = (HideFlags)0; } placeable = ((Component)this).GetComponentInChildren(); UseLitMaterials(); componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { string[] array = ((Object)val).name.Split('_'); if (array.Length == 3 && !(array[0] != "Spot")) { if (!CatItem.TryParsePose(array[2], out var pose)) { Plugin.Log.LogWarning((object)("Cat tree spot " + ((Object)val).name + ": unknown clip " + array[2])); continue; } Spots.Add(new Spot { Point = val, Name = array[1], Pose = pose, Host = this }); } } } private void UseLitMaterials() { //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_0091: Expected O, but got Unknown //IL_00b3: 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 (litShader == null) { litShader = Shader.Find("HDRP/Lit"); } if ((Object)(object)litShader == (Object)null) { return; } MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (MeshRenderer val in componentsInChildren) { Material[] sharedMaterials = ((Renderer)val).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if (!((Object)(object)sharedMaterials[j] == (Object)null)) { if (!litMats.TryGetValue(((Object)sharedMaterials[j]).name, out var value)) { value = new Material(litShader) { name = ((Object)sharedMaterials[j]).name + " (Lit)" }; value.SetColor("_BaseColor", sharedMaterials[j].HasProperty("_Color") ? sharedMaterials[j].color : Color.grey); value.SetFloat("_Smoothness", 0.1f); litMats[((Object)sharedMaterials[j]).name] = value; } sharedMaterials[j] = value; } } ((Renderer)val).sharedMaterials = sharedMaterials; } } [HarmonyPatch(typeof(AutoParentToShip), "Awake")] [HarmonyPrefix] private static void DefaultSpot(AutoParentToShip __instance) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)((Component)__instance).GetComponent() == (Object)null)) { PlaceableShipObject componentInChildren = ((Component)__instance).GetComponentInChildren(); __instance.unlockableID = componentInChildren.unlockableID; Bounds bounds = instance.shipInnerRoomBounds.bounds; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y - 0.1f, ((Bounds)(ref bounds)).center.z); RaycastHit val2 = default(RaycastHit); val = (Vector3)(Physics.Raycast(val, Vector3.down, ref val2, ((Bounds)(ref bounds)).size.y + 1f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val2)).point : new Vector3(val.x, ((Bounds)(ref bounds)).min.y, val.z)); __instance.overrideOffset = true; __instance.positionOffset = instance.elevatorTransform.InverseTransformPoint(val); __instance.rotationOffset = Vector3.zero; Plugin.Log.LogInfo((object)$"Cat tree default spot {val} (ship-local {__instance.positionOffset}), unlockable {componentInChildren.unlockableID}"); } } } public class FurniturePerch : PerchHost { private class Def { public string Match; public string Name; public Vector3? Local; public float Yaw; public float Height01; public Color Color; } internal class TunedSpot : Spot { public Vector3 Local; public float Yaw; public Color Color; } internal class Scanner : MonoBehaviour { private float next; private readonly HashSet logged = new HashSet(); private void Update() { if (Time.unscaledTime < next) { return; } next = Time.unscaledTime + 2f; List list = StartOfRound.Instance?.unlockablesList?.unlockables; if (list == null) { return; } PlaceableShipObject[] array = Object.FindObjectsOfType(); foreach (PlaceableShipObject val in array) { if (val.unlockableID < 0 || val.unlockableID >= list.Count) { continue; } GameObject val2 = (((Object)(object)val.parentObject != (Object)null) ? ((Component)val.parentObject).gameObject : (((Object)(object)val.mainTransform != (Object)null) ? ((Component)val.mainTransform).gameObject : null)); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.GetComponent() != (Object)null)) { string unlockableName = list[val.unlockableID].unlockableName; if (logged.Add(unlockableName)) { Plugin.Log.LogInfo((object)("Ship furniture: " + unlockableName)); } string lower = unlockableName.ToLowerInvariant(); if (Defs.Any((Def d) => lower.Contains(d.Match))) { val2.AddComponent().Setup(val, unlockableName); } } } } } private static readonly Def[] Defs = new Def[4] { new Def { Match = "bunk", Name = "TopBunk", Local = new Vector3(1.649f, 1.1f, -0.737f), Yaw = 240f, Color = new Color(1f, 0.25f, 0.25f) }, new Def { Match = "bunk", Name = "BottomBunk", Local = new Vector3(1.494f, -0.813f, -0.711f), Yaw = 240f, Color = new Color(1f, 0.6f, 0.1f) }, new Def { Match = "cabinet", Name = "Top", Local = new Vector3(0f, 0.887f, 0.01f), Yaw = 225f, Color = new Color(0.3f, 1f, 0.3f) }, new Def { Match = "cupboard", Name = "Top", Local = new Vector3(1.093f, 1.542f, 0.457f), Yaw = 225f, Color = new Color(1f, 0.35f, 1f) } }; private string furnitureName; private Transform root; public override string Label => furnitureName; internal IEnumerable Tuned => Spots.OfType(); private void Setup(PlaceableShipObject place, string name) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) placeable = place; furnitureName = name; root = ((Component)this).transform; string lower = name.ToLowerInvariant(); Bounds? val = null; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren(); foreach (Renderer val2 in componentsInChildren) { if (!((Object)(object)((Component)val2).GetComponentInParent() != (Object)null)) { if (!val.HasValue) { val = val2.bounds; continue; } Bounds value = val.Value; ((Bounds)(ref value)).Encapsulate(val2.bounds); val = value; } } Quaternion val3 = Frame(); Vector3 val4 = default(Vector3); foreach (Def item in Defs.Where((Def d) => lower.Contains(d.Match))) { Vector3 local = (Vector3)(((??)item.Local) ?? Vector3.zero); if (!item.Local.HasValue && val.HasValue) { Bounds value2 = val.Value; ((Vector3)(ref val4))..ctor(((Bounds)(ref value2)).center.x, ((Bounds)(ref value2)).min.y + ((Bounds)(ref value2)).size.y * item.Height01, ((Bounds)(ref value2)).center.z); local = Quaternion.Inverse(val3) * (val4 - root.position); } Transform transform = new GameObject("CozyPerch_" + item.Name).transform; transform.SetParent(root, false); TunedSpot tunedSpot = new TunedSpot { Point = transform, Name = item.Name, Pose = 6, Host = this, Local = local, Yaw = item.Yaw, Color = item.Color }; Spots.Add(tunedSpot); Apply(tunedSpot); } Plugin.Log.LogInfo((object)("Nap spots on the " + name + ": " + string.Join(", ", Spots.Select((Spot s) => s.Name)))); } private Quaternion Frame() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(root.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.ProjectOnPlane(root.up, Vector3.up); } return Quaternion.LookRotation(val, Vector3.up); } internal void Apply(TunedSpot s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Frame(); s.Point.position = root.position + val * s.Local; s.Point.rotation = val * Quaternion.Euler(0f, s.Yaw, 0f) * Quaternion.Euler(-90f, 0f, 0f); } internal void SetWorld(TunedSpot s, Vector3 world) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) s.Local = Quaternion.Inverse(Frame()) * (world - root.position); Apply(s); } } [HarmonyPatch] internal static class Patches { [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void AfterStartOfRoundAwake(StartOfRound __instance) { CatRegistry.FixupFromGame(__instance); CatTree.FixupFromGame(__instance); ((Component)__instance).gameObject.AddComponent(); } [HarmonyPatch(typeof(DepositItemsDesk), "PlaceItemOnCounter")] [HarmonyPrefix] private static bool KeepCatsOffCounter(PlayerControllerB playerWhoTriggered) { if ((Object)(object)playerWhoTriggered == (Object)null || !(playerWhoTriggered.currentlyHeldObjectServer is CatItem catItem)) { return true; } HUDManager.Instance.DisplayTip("Absolutely not.", "The Company can't have " + catItem.CatName + ".", true, false, "LC_Tip1"); return false; } [HarmonyPatch(typeof(HUDManager), "DisplayNewScrapFound")] [HarmonyPrefix] private static void BeforeDisplayScrap(HUDManager __instance, int ___nextBoxIndex, out (CatItem cat, int box) __state) { __state = default((CatItem, int)); if (__instance.itemsToBeDisplayed.Count > 0 && __instance.itemsToBeDisplayed[0] is CatItem item) { __state = (cat: item, box: ___nextBoxIndex); } } [HarmonyPatch(typeof(HUDManager), "DisplayNewScrapFound")] [HarmonyPostfix] private static void AfterDisplayScrap(HUDManager __instance, (CatItem cat, int box) __state) { if (!((Object)(object)__state.cat == (Object)null)) { ScrapItemHUDDisplay obj = __instance.ScrapItemBoxes[__state.box]; ((TMP_Text)obj.headerText).text = __state.cat.CatName + " rescued!"; ((TMP_Text)obj.valueText).text = $"Bounty: ${__state.cat.PendingBountyDisplay}"; } } [HarmonyPatch(typeof(Landmine), "OnTriggerEnter")] [HarmonyPrefix] private static bool CatsDontTriggerMines(Collider other) { return (Object)(object)((Component)other).GetComponent() == (Object)null; } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPostfix] private static void SpawnCats(RoundManager __instance) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsServer || (Object)(object)CatRegistry.Prefab == (Object)null) { return; } CatConfig cfg = Plugin.Cfg; float value = cfg.SpecialCatChance.Value; HashSet hashSet = new HashSet(from c in Object.FindObjectsOfType() select c.CatName); List list = new List(); foreach (string specialName in CatLooks.SpecialNames) { if (!hashSet.Contains(specialName) && !(Random.value >= value)) { int num = CatLooks.SeedFor(specialName); if (num != 0) { list.Add(num); } } } float[] array = cfg.ParseCatChances(); foreach (float num3 in array) { if (Random.value >= num3) { break; } list.Add(0); } if (list.Count == 0) { return; } RandomScrapSpawn[] array2 = Object.FindObjectsOfType(); if (array2.Length == 0) { return; } foreach (int item in list) { RandomScrapSpawn val = array2[Random.Range(0, array2.Length)]; Vector3 randomNavMeshPositionInRadiusSpherical = __instance.GetRandomNavMeshPositionInRadiusSpherical(((Component)val).transform.position, Mathf.Max(val.itemSpawnRange, 1f), default(NavMeshHit)); GameObject obj = Object.Instantiate(CatRegistry.Prefab, randomNavMeshPositionInRadiusSpherical, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), __instance.spawnedScrapContainer); obj.GetComponent().fallTime = 0f; CatItem component = obj.GetComponent(); if (item != 0) { component.SetSeed(item); } obj.GetComponent().Spawn(false); Plugin.Log.LogInfo((object)string.Format("{0} hiding in the facility at {1} (spawner {2} at {3})", (item != 0) ? (component.CatName + " (special)") : "Cat", randomNavMeshPositionInRadiusSpherical, ((Object)val).name, ((Component)val).transform.position)); } if (hashSet.Count > 0) { Plugin.Log.LogInfo((object)("Cats already aboard: " + string.Join(", ", hashSet))); } } } public abstract class PerchHost : MonoBehaviour { internal class Spot { public Transform Point; public string Name; public byte Pose; public PerchHost Host; public CatItem Occupant; } internal static readonly List All = new List(); internal readonly List Spots = new List(); protected PlaceableShipObject placeable; public abstract string Label { get; } public bool IsOut { get { //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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)placeable != (Object)null && placeable.unlockableID >= 0 && placeable.unlockableID < StartOfRound.Instance.unlockablesList.unlockables.Count && !StartOfRound.Instance.unlockablesList.unlockables[placeable.unlockableID].inStorage) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; return ((Bounds)(ref bounds)).Contains(((Component)placeable).transform.position + Vector3.up * 0.3f); } return false; } } public Bounds Footprint => placeable.placeObjectCollider.bounds; protected virtual void OnEnable() { All.Add(this); } protected virtual void OnDisable() { All.Remove(this); } internal static IEnumerable FreeSpots() { return from s in All.Where((PerchHost h) => h.IsOut).SelectMany((PerchHost h) => h.Spots) where (Object)(object)s.Occupant == (Object)null || !s.Occupant.Claims(s) select s; } internal static Spot RandomFreeSpot() { List list = FreeSpots().ToList(); if (list.Count <= 0) { return null; } return list[Random.Range(0, list.Count)]; } internal static float SpotYaw(Spot s) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) Vector3 val = Vector3.ProjectOnPlane(-s.Point.up, Vector3.up); if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { return s.Point.eulerAngles.y; } Quaternion val2 = Quaternion.LookRotation(val); return ((Quaternion)(ref val2)).eulerAngles.y; } internal void Release(CatItem cat) { foreach (Spot spot in Spots) { if ((Object)(object)spot.Occupant == (Object)(object)cat) { spot.Occupant = null; } } } internal bool FloorBeside(Vector3 near, out Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f0: 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_01a8: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; Bounds footprint = Footprint; float num = Mathf.Max(((Bounds)(ref footprint)).extents.x, ((Bounds)(ref footprint)).extents.z) + 0.45f; Vector3 center = ((Bounds)(ref footprint)).center; Vector3 val = Vector3.ProjectOnPlane(near - center, Vector3.up); float num2; if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { num2 = Random.Range(0f, 360f); } else { Quaternion val2 = Quaternion.LookRotation(val); num2 = ((Quaternion)(ref val2)).eulerAngles.y; } float num3 = num2; List list = new List(); RaycastHit val4 = default(RaycastHit); for (int i = 0; i < 12; i++) { float num4 = num3 + (float)(((i % 2 == 0) ? 1 : (-1)) * (i + 1) / 2) * 30f; Vector3 val3 = center + Quaternion.Euler(0f, num4, 0f) * Vector3.forward * num; val3.y = ((Bounds)(ref footprint)).min.y + 1f; if (Physics.Raycast(val3, Vector3.down, ref val4, 2.5f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { Bounds bounds = instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((RaycastHit)(ref val4)).point + Vector3.up * 0.3f)) { list.Add(((RaycastHit)(ref val4)).point); } } } if (list.Count > 0) { float floor = list.Min((Vector3 h) => h.y); point = list.First((Vector3 h) => h.y < floor + 0.2f); return true; } point = default(Vector3); return false; } } [BepInPlugin("CozyCats", "CozyCats", "2.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static CatConfig Cfg; private void Awake() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Cfg = new CatConfig(((BaseUnityPlugin)this).Config); CatLooks.LoadSpecials(Cfg.SpecialCats.Value); InitNetcodePatcher(); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "cozycats"); if (!CatAssets.Load(text)) { Log.LogError((object)("Asset bundle missing at " + text + "; cats disabled.")); return; } CatRegistry.Register(); CatTree.Register(); new Harmony("CozyCats").PatchAll(); Log.LogInfo((object)"CozyCats 2.1.2 loaded. Meow."); } private static void InitNetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "CozyCats"; public const string PLUGIN_NAME = "CozyCats"; public const string PLUGIN_VERSION = "2.1.2"; } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_FixedString(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); } } } namespace CozyCats.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }