using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using Unity.Netcode.Samples;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NeedyCats")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NeedyCats")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c7d3e258-85ed-4246-9766-b0915f7aec88")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal class <Module>
{
static <Module>()
{
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace NeedyCats
{
public class CatFoodProp : GrabbableObject
{
public Animator animator;
public AudioSource noiseAudio;
public AudioClip removeLidAudio;
public GameObject catfoodMeshFull;
public GameObject catfoodMeshHalf;
public float FeedLength = 528f;
private float feedingTimer;
private bool isOpen;
[HideInInspector]
public bool IsFeeding;
public override void Start()
{
((GrabbableObject)this).Start();
animator = ((Component)this).GetComponent<Animator>();
NeedyCatsBase.Instance.AllCatFoods.Add(this);
AudioMixer diageticMixer = SoundManager.Instance.diageticMixer;
noiseAudio.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0];
((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback;
}
public override void OnDestroy()
{
NeedyCatsBase.Instance.AllCatFoods.Remove(this);
((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback;
((NetworkBehaviour)this).OnDestroy();
}
public override void LoadItemSaveData(int saveData)
{
((MonoBehaviour)this).StartCoroutine(NetworkSafeLoadItemSaveData(saveData));
}
private IEnumerator NetworkSafeLoadItemSaveData(int saveData)
{
yield return (object)new WaitUntil((Func<bool>)(() => ((NetworkBehaviour)this).IsSpawned));
if (((NetworkBehaviour)this).IsServer)
{
<>n__0(saveData);
if ((saveData & 1) == 1)
{
isOpen = true;
feedingTimer = 0f;
LateJoinerOpenCanClientRpc();
UpdateCatFoodStatusClientRpc("Empty");
}
}
}
public override int GetItemDataToSave()
{
int num = 0;
return num | (isOpen ? 1 : 0);
}
private void NetworkManager_OnClientConnectedCallback(ulong clientId)
{
//IL_000d: 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_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)this).IsServer)
{
return;
}
ClientRpcParams val = default(ClientRpcParams);
val.Send = new ClientRpcSendParams
{
TargetClientIds = new ulong[1] { clientId }
};
ClientRpcParams clientRpcParams = val;
if (isOpen)
{
LateJoinerOpenCanClientRpc(clientRpcParams);
if (feedingTimer <= 0f)
{
UpdateCatFoodStatusClientRpc("Empty", clientRpcParams);
}
else if (feedingTimer < FeedLength / 2f)
{
UpdateCatFoodStatusClientRpc("Half (6 hours)", clientRpcParams);
}
else
{
UpdateCatFoodStatusClientRpc("Full (12 hours)", clientRpcParams);
}
}
}
public override void Update()
{
((GrabbableObject)this).Update();
if (IsFeeding && ((NetworkBehaviour)this).IsServer)
{
feedingTimer -= Time.deltaTime;
if (feedingTimer <= 0f)
{
IsFeeding = false;
}
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!isOpen && ((NetworkBehaviour)this).IsOwner)
{
OpenCanServerRpc();
}
}
public override void SetControlTipsForItem()
{
if (isOpen)
{
HUDManager.Instance.ClearControlTips();
HUDManager.Instance.ChangeControlTipMultiple((string[])null, true, base.itemProperties);
}
else
{
((GrabbableObject)this).SetControlTipsForItem();
}
}
[ServerRpc(RequireOwnership = false)]
public void OpenCanServerRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3509606797u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3509606797u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
OpenCanClientRpc();
IsFeeding = true;
feedingTimer = FeedLength;
((MonoBehaviour)this).StartCoroutine(UpdateCatFoodStatusCoroutine());
}
}
}
[ClientRpc]
public void OpenCanClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1094053100u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1094053100u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isOpen = true;
base.playerHeldBy.doingUpperBodyEmote = 1.16f;
base.playerHeldBy.playerBodyAnimator.SetTrigger("PullGrenadePin");
animator.SetTrigger("use");
((MonoBehaviour)this).StartCoroutine(OpenCanCoroutine());
((Component)this).GetComponentInChildren<ScanNodeProperties>().headerText = "Cat food (Opened)";
if (((NetworkBehaviour)this).IsOwner && base.isHeld)
{
((GrabbableObject)this).SetControlTipsForItem();
}
}
}
private IEnumerator OpenCanCoroutine()
{
yield return (object)new WaitForSeconds(0.7f);
noiseAudio.PlayOneShot(removeLidAudio, 1f);
}
[ClientRpc]
public void LateJoinerOpenCanClientRpc(ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1289399889u, clientRpcParams, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val, 1289399889u, clientRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isOpen = true;
((Component)this).GetComponentInChildren<ScanNodeProperties>().headerText = "Cat food (Opened)";
animator.SetTrigger("use");
}
}
}
private IEnumerator UpdateCatFoodStatusCoroutine()
{
UpdateCatFoodStatusClientRpc("Full (12 hours)");
yield return (object)new WaitForSeconds(FeedLength / 2f);
UpdateCatFoodStatusClientRpc("Half (6 hours)");
yield return (object)new WaitForSeconds(FeedLength / 2f);
UpdateCatFoodStatusClientRpc("Empty");
}
[ClientRpc]
public void UpdateCatFoodStatusClientRpc(string statusText, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1085257088u, clientRpcParams, (RpcDelivery)0);
bool flag = statusText != null;
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val)).WriteValueSafe(statusText, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val, 1085257088u, clientRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
switch (statusText)
{
case "Full (12 hours)":
catfoodMeshFull.SetActive(true);
catfoodMeshHalf.SetActive(false);
break;
case "Half (6 hours)":
catfoodMeshFull.SetActive(false);
catfoodMeshHalf.SetActive(true);
break;
default:
catfoodMeshFull.SetActive(false);
catfoodMeshHalf.SetActive(false);
break;
}
((Component)this).GetComponentInChildren<ScanNodeProperties>().subText = statusText;
}
}
[CompilerGenerated]
[DebuggerHidden]
private void <>n__0(int saveData)
{
((GrabbableObject)this).LoadItemSaveData(saveData);
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_CatFoodProp()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3509606797u, new RpcReceiveHandler(__rpc_handler_3509606797));
NetworkManager.__rpc_func_table.Add(1094053100u, new RpcReceiveHandler(__rpc_handler_1094053100));
NetworkManager.__rpc_func_table.Add(1289399889u, new RpcReceiveHandler(__rpc_handler_1289399889));
NetworkManager.__rpc_func_table.Add(1085257088u, new RpcReceiveHandler(__rpc_handler_1085257088));
}
private static void __rpc_handler_3509606797(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;
((CatFoodProp)(object)target).OpenCanServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1094053100(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)2;
((CatFoodProp)(object)target).OpenCanClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1289399889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((CatFoodProp)(object)target).LateJoinerOpenCanClientRpc(client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1085257088(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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_007a: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string statusText = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref statusText, false);
}
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((CatFoodProp)(object)target).UpdateCatFoodStatusClientRpc(statusText, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "CatFoodProp";
}
}
public class MouthDogAICollisionDetect : MonoBehaviour
{
public NeedyCatProp catScript;
private void OnTriggerStay(Collider other)
{
if (!((GrabbableObject)catScript).reachedFloorTarget || !((Component)other).CompareTag("Enemy"))
{
return;
}
EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null && (Object)(object)component.mainScript != (Object)(object)catScript)
{
EnemyAI mainScript = component.mainScript;
MouthDogAI val = (MouthDogAI)(object)((mainScript is MouthDogAI) ? mainScript : null);
if (val != null && val.inLunge)
{
NeedyCatProp needyCatProp = catScript;
EnemyAI mainScript2 = component.mainScript;
needyCatProp.OnCollideWithDog(other, (MouthDogAI)(object)((mainScript2 is MouthDogAI) ? mainScript2 : null));
}
}
}
}
public class NeedyCatProp : GrabbableObject, INoiseListener
{
[Space(3f)]
public Animator animator;
public AudioSource audioSource;
public SkinnedMeshRenderer skinnedMeshRenderer;
public Material[] materials;
[Space(3f)]
public Vector2 IntervalMeow;
public Vector2 IntervalMove;
public Vector2 IntervalSitAnimChange;
public Vector2 IntervalIdleAnimChange;
public float WalkingSpeed = 1f;
public float RunningSpeed = 8f;
private (int, float)[] placeableMeowInterval;
[HideInInspector]
public (string, int)[] CatNames;
private float timeBeforeNextMove = 1f;
private float timeBeforeNextMeow = 1f;
private float timeBeforeNextSitAnim = 1f;
private int sitAnimationsLength = 3;
private float timeBeforeNextIdleAnim = 1f;
private int idleAnimationsLength = 4;
private float timeBeforeTryFlee = -1f;
private float timeBeforeTryFleeLength = 2.5f;
private bool isSitting;
private bool isFleeing;
private bool isFeeding;
private int materialIndex;
private int nameIndex;
private bool hasLoadedSave;
private HoarderBugItem hoarderBugItem;
[Space(3f)]
public AudioClip[] noiseSFX;
public AudioClip[] fleeSFX;
public AudioClip[] calmSFX;
[Space(3f)]
public float noiseRange = 65f;
public float maxLoudness = 1f;
public float minLoudness = 0.95f;
public float minPitch = 0.9f;
public float maxPitch = 1f;
private NavMeshAgent agent;
private Random random;
[Space(3f)]
public Vector3 destination;
private GameObject[] allAINodes;
private NavMeshPath navmeshPath;
private float velX;
private float velY;
private Vector3 previousPosition;
private Vector3 agentLocalVelocity;
private IEnumerator fleeCoroutine;
private ClientNetworkTransform clientNetworkTransform;
private bool isBeingHoarded
{
get
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (hoarderBugItem != null)
{
return Vector3.Distance(((Component)this).transform.position, hoarderBugItem.itemNestPosition) < 2f;
}
return false;
}
}
public void Awake()
{
}
public override void Start()
{
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Expected O, but got Unknown
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
((GrabbableObject)this).Start();
try
{
if ((Object)(object)agent == (Object)null)
{
agent = ((Component)this).GetComponent<NavMeshAgent>();
}
if ((Object)(object)animator == (Object)null)
{
animator = ((Component)this).GetComponentInChildren<Animator>();
}
if ((Object)(object)skinnedMeshRenderer == (Object)null)
{
skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
}
clientNetworkTransform = ((Component)this).GetComponent<ClientNetworkTransform>();
random = new Random(StartOfRound.Instance.randomMapSeed + 85);
GameObject[] first = GameObject.FindGameObjectsWithTag("AINode");
GameObject[] second = GameObject.FindGameObjectsWithTag("OutsideAINode");
allAINodes = first.Concat(second).ToArray();
agent.updatePosition = false;
destination = ((Component)this).transform.position;
navmeshPath = new NavMeshPath();
AudioMixer diageticMixer = SoundManager.Instance.diageticMixer;
audioSource.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0];
((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback;
NetworkManager.Singleton.SceneManager.OnLoadComplete += new OnLoadCompleteDelegateHandler(SceneManager_OnLoadComplete);
placeableMeowInterval = new(int, float)[3]
{
(22, 15f),
(21, 4f),
(4, 10f)
};
}
catch (Exception arg)
{
Debug.LogError((object)$"Error when initializing variables for {((Object)((Component)this).gameObject).name} : {arg}");
}
if (((NetworkBehaviour)this).IsServer && !hasLoadedSave)
{
nameIndex = Random.Range(0, CatNames.Length);
SetCatNameServerRpc(CatNames[nameIndex].Item1);
if (CatNames[nameIndex].Item2 != -1)
{
materialIndex = CatNames[nameIndex].Item2;
}
else
{
materialIndex = Random.Range(0, materials.Length);
}
SetCatMaterialServerRpc(materialIndex);
}
}
public override void OnDestroy()
{
((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback;
((NetworkBehaviour)this).OnDestroy();
}
private void NetworkManager_OnClientConnectedCallback(ulong obj)
{
if (((NetworkBehaviour)this).IsServer)
{
SetCatMaterialServerRpc(materialIndex);
SetCatNameServerRpc(CatNames[nameIndex].Item1);
if (isSitting)
{
MakeCatSitServerRpc(sit: true);
}
}
}
private void SceneManager_OnLoadComplete(ulong clientId, string sceneName, LoadSceneMode loadSceneMode)
{
GameObject[] first = GameObject.FindGameObjectsWithTag("AINode");
GameObject[] second = GameObject.FindGameObjectsWithTag("OutsideAINode");
allAINodes = first.Concat(second).ToArray();
}
public override void LoadItemSaveData(int saveData)
{
((MonoBehaviour)this).StartCoroutine(NetworkSafeLoadItemSaveData(saveData));
}
private IEnumerator NetworkSafeLoadItemSaveData(int saveData)
{
yield return ((NetworkBehaviour)this).IsSpawned;
if (((NetworkBehaviour)this).IsServer)
{
<>n__0(saveData);
int catMaterialServerRpc = (saveData >> 16) & 0xFFFF;
int num = saveData & 0xFFFF;
if (num > CatNames.Length)
{
num = Random.Range(0, CatNames.Length);
}
SetCatNameServerRpc(CatNames[num].Item1);
if (CatNames[num].Item2 != -1)
{
catMaterialServerRpc = CatNames[num].Item2;
}
SetCatMaterialServerRpc(catMaterialServerRpc);
materialIndex = catMaterialServerRpc;
nameIndex = num;
hasLoadedSave = true;
}
}
public override int GetItemDataToSave()
{
return (materialIndex << 16) | nameIndex;
}
private void SynchronizeAnimator(float maxSpeed = 4f)
{
//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)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
agentLocalVelocity = ((Component)animator).transform.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f));
animator.SetBool("move", ((Vector3)(ref agentLocalVelocity)).magnitude > 0.05f);
velX = Mathf.Lerp(velX, agentLocalVelocity.x, 10f * Time.deltaTime);
animator.SetFloat("velx", Mathf.Clamp(velX, 0f - maxSpeed, maxSpeed));
velY = Mathf.Lerp(velY, agentLocalVelocity.z, 10f * Time.deltaTime);
animator.SetFloat("vely", Mathf.Clamp(velY, 0f - maxSpeed, maxSpeed));
previousPosition = ((Component)this).transform.position;
}
public override void GrabItem()
{
animator.SetBool("move", false);
animator.SetFloat("velx", 0f);
animator.SetFloat("vely", 0f);
animator.SetBool("held", true);
animator.ResetTrigger("sit");
isSitting = false;
isFleeing = false;
StopCatFleeServerRpc();
if (fleeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(fleeCoroutine);
}
((GrabbableObject)this).GrabItem();
if (((NetworkBehaviour)this).IsOwner)
{
HUDManager.Instance.DisplayTip("Cat Facts", "Too noisy? Give your cat a pet to quiet it down for a bit!", false, true, "LC_NeedyCatsTip");
}
}
public override void DiscardItem()
{
animator.SetBool("held", false);
((GrabbableObject)this).DiscardItem();
}
public override void GrabItemFromEnemy(EnemyAI enemy)
{
base.isHeldByEnemy = true;
animator.SetBool("move", false);
animator.SetFloat("velx", 0f);
animator.SetFloat("vely", 0f);
animator.SetBool("held", true);
animator.ResetTrigger("sit");
isSitting = false;
isFleeing = false;
StopCatFleeServerRpc();
if (fleeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(fleeCoroutine);
}
((GrabbableObject)this).GrabItemFromEnemy(enemy);
if (((NetworkBehaviour)this).IsServer)
{
HoarderBugAI val = (HoarderBugAI)(object)((enemy is HoarderBugAI) ? enemy : null);
if (val != null)
{
hoarderBugItem = (((Object)(object)val.heldItem.itemGrabbableObject == (Object)(object)this) ? val.heldItem : null);
}
}
}
public override void DiscardItemFromEnemy()
{
base.isHeldByEnemy = false;
animator.SetBool("held", false);
((GrabbableObject)this).DiscardItemFromEnemy();
}
public override void Update()
{
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0401: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)clientNetworkTransform).enabled = !base.isHeld && !base.isHeldByEnemy;
if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && !((NetworkBehaviour)this).IsOwner)
{
((Component)this).GetComponent<NetworkObject>().RemoveOwnership();
}
if (!isFleeing && !base.isInElevator && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
((Behaviour)agent).enabled = !base.isHeld && !base.isHeldByEnemy && base.reachedFloorTarget && !(base.fallTime < 1f);
if (base.fallTime >= 1f && !base.reachedFloorTarget)
{
base.targetFloorPosition = ((Component)this).transform.position;
destination = ((Component)this).transform.position;
previousPosition = ((Component)this).transform.position;
((Behaviour)agent).enabled = true;
}
}
if (!base.isHeld && !base.isHeldByEnemy && base.fallTime >= 1f && !base.reachedFloorTarget && animator.GetBool("held"))
{
animator.SetBool("held", false);
}
if (!isFleeing)
{
if (base.isHeld || base.isHeldByEnemy || !base.reachedFloorTarget || base.fallTime < 1f || base.isInElevator)
{
((GrabbableObject)this).Update();
}
if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && (base.isInElevator || isBeingHoarded) && !isSitting)
{
MakeCatSitServerRpc(sit: true);
}
else if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && !base.isInElevator && !isBeingHoarded && isSitting && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
MakeCatSitServerRpc(sit: false);
}
}
if (((NetworkBehaviour)this).IsServer)
{
if (isSitting)
{
if (timeBeforeNextSitAnim <= 0f)
{
SetCatSitAnimationServerRpc(Random.Range(0, sitAnimationsLength));
timeBeforeNextSitAnim = Random.Range(IntervalSitAnimChange.x, IntervalSitAnimChange.y);
}
timeBeforeNextSitAnim -= Time.deltaTime;
}
else
{
if (timeBeforeNextIdleAnim <= 0f)
{
SetCatIdleAnimationServerRpc(Random.Range(0, idleAnimationsLength));
timeBeforeNextIdleAnim = Random.Range(IntervalIdleAnimChange.x, IntervalIdleAnimChange.y);
}
timeBeforeNextIdleAnim -= Time.deltaTime;
}
if (timeBeforeNextMeow <= 0f)
{
MakeCatMeowServerRpc();
float num = CalculateCatMeowInterval();
timeBeforeNextMeow = Random.Range(IntervalMeow.x + num, IntervalMeow.y + num);
}
timeBeforeNextMeow -= Time.deltaTime;
if (timeBeforeTryFlee >= 0f)
{
timeBeforeTryFlee -= Time.deltaTime;
}
if (!isFleeing)
{
if (!base.isHeld && !base.isHeldByEnemy && !base.isInElevator && !isBeingHoarded && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
if (timeBeforeNextMove <= 0f)
{
SetRandomDestination();
timeBeforeNextMove = Random.Range(IntervalMove.x, IntervalMove.y);
}
timeBeforeNextMove -= Time.deltaTime;
((Component)this).transform.position = agent.nextPosition;
}
}
else if (isFleeing)
{
((Component)this).transform.position = agent.nextPosition;
base.targetFloorPosition = ((Component)this).transform.position;
}
}
if (!base.isHeld && !base.isHeldByEnemy)
{
SynchronizeAnimator();
}
}
public float CalculateCatMeowInterval()
{
float num = 0f;
if (base.isInElevator)
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (val.isInElevator)
{
num += 6f;
break;
}
}
(int, float)[] array = placeableMeowInterval;
for (int j = 0; j < array.Length; j++)
{
(int, float) tuple = array[j];
if (StartOfRound.Instance.SpawnedShipUnlockables.ContainsKey(tuple.Item1))
{
num += tuple.Item2;
}
}
}
if (!NeedyCatsBase.Instance.CatFoodSilence.Value && CheckForCatFood())
{
num += 120f;
}
return num;
}
public bool CheckForCatFood()
{
//IL_0030: 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)
foreach (CatFoodProp allCatFood in NeedyCatsBase.Instance.AllCatFoods)
{
if (((GrabbableObject)allCatFood).reachedFloorTarget && allCatFood.IsFeeding && Vector3.Distance(((Component)allCatFood).transform.position, ((Component)this).transform.position) < 10f)
{
return true;
}
}
return false;
}
public void SetDestinationToPosition(Vector3 position, bool checkForPath = false)
{
//IL_00c4: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0034: 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_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_0092: Unknown result type (might be due to invalid IL or missing references)
if (checkForPath)
{
position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 1.75f, -1);
navmeshPath = new NavMeshPath();
if (!agent.CalculatePath(position, navmeshPath))
{
Debug.Log((object)(((Object)((Component)this).gameObject).name + " calculatepath returned false."));
return;
}
if (Vector3.Distance(navmeshPath.corners[navmeshPath.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 2.7f, -1)) > 1.55f)
{
Debug.Log((object)(((Object)((Component)this).gameObject).name + " path calculation went wrong."));
return;
}
}
destination = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, -1f, -1);
agent.SetDestination(destination);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (((NetworkBehaviour)this).IsOwner)
{
MakeCatCalmServerRpc();
}
}
public void SetRandomDestination()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = ((Component)this).transform.position + Random.insideUnitSphere * 5f;
agent.speed = WalkingSpeed;
SetDestinationToPosition(position);
}
private void PlayCatNoise(AudioClip[] array, bool audible = true)
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
int num = random.Next(0, array.Length);
float num2 = (float)random.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)random.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
audioSource.pitch = pitch;
audioSource.PlayOneShot(array[num], num2);
WalkieTalkie.TransmitOneShotAudio(audioSource, array[num], num2 - 0.4f);
if (audible)
{
float num3 = (base.isInElevator ? (noiseRange - 2.5f) : noiseRange);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, num3, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 8881);
}
}
[ServerRpc(RequireOwnership = false)]
public void MakeCatMeowServerRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3454429685u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3454429685u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
if (!isFeeding && CheckForCatFood())
{
isFeeding = true;
return;
}
if (isFeeding && !CheckForCatFood())
{
isFeeding = false;
}
if (!NeedyCatsBase.Instance.CatFoodSilence.Value || !CheckForCatFood())
{
MakeCatMeowClientRpc();
}
}
[ClientRpc]
public void MakeCatMeowClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1946573138u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1946573138u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
PlayCatNoise(noiseSFX);
animator.SetTrigger("meow");
}
}
}
[ClientRpc]
public void MakeCatFleeClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2532932337u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2532932337u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
animator.SetBool("sit", false);
PlayCatNoise(fleeSFX);
animator.SetTrigger("meow");
((Component)this).transform.SetParent((Transform)null, true);
isFleeing = true;
base.isInElevator = false;
isSitting = false;
}
}
}
[ServerRpc(RequireOwnership = false)]
public void StopCatFleeServerRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3642870494u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3642870494u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
StopCatFleeClientRpc();
}
}
}
[ClientRpc]
public void StopCatFleeClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2708699245u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2708699245u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isFleeing = false;
}
}
}
[ServerRpc]
public void MakeCatCalmServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: 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_00b3: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2784153610u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2784153610u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
float num = CalculateCatMeowInterval();
timeBeforeNextMeow = Random.Range(IntervalMeow.x + num + 3f, IntervalMeow.y + num + 6f);
MakeCatCalmClientRpc();
}
}
public void OnCollideWithDog(Collider other, MouthDogAI mouthDogAI)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)this).IsServer || !(timeBeforeTryFlee <= 0f))
{
return;
}
if (Random.Range(0f, 100f) > NeedyCatsBase.Instance.CatFleeDogsChance.Value)
{
timeBeforeTryFlee = timeBeforeTryFleeLength;
return;
}
Vector3 val = ((Component)other).transform.position - ((Component)this).transform.position;
((Behaviour)agent).enabled = true;
Vector3 position = ((Component)this).transform.position - ((Vector3)(ref val)).normalized * 40f;
GameObject[] array = allAINodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray();
agent.nextPosition = ((Component)this).transform.position;
SetDestinationToPosition(array[0].transform.position);
agent.speed = RunningSpeed;
timeBeforeNextMove = Random.Range(IntervalMove.x + 5f, IntervalMove.y + 10f);
timeBeforeNextMeow = Random.Range(IntervalMeow.x, IntervalMeow.y);
timeBeforeTryFlee = timeBeforeTryFleeLength;
if (fleeCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(fleeCoroutine);
}
fleeCoroutine = FleeCoroutine(timeBeforeNextMove);
((MonoBehaviour)this).StartCoroutine(fleeCoroutine);
MakeCatFleeClientRpc();
}
public IEnumerator FleeCoroutine(float time)
{
yield return (object)new WaitForSeconds(time);
StopCatFleeClientRpc();
}
[ClientRpc]
public void MakeCatCalmClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2302897036u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2302897036u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.playerHeldBy.doingUpperBodyEmote = 1.16f;
base.playerHeldBy.playerBodyAnimator.SetTrigger("PullGrenadePin2");
((MonoBehaviour)this).StartCoroutine(PlayCatCalmNoiseDelayed());
}
}
}
private IEnumerator PlayCatCalmNoiseDelayed()
{
yield return (object)new WaitForSeconds(0.5f);
PlayCatNoise(calmSFX, audible: false);
}
[ServerRpc]
public void MakeCatSitServerRpc(bool sit)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_00a5: 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_00b3: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2411027775u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sit, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2411027775u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
MakeCatSitClientRpc(sit);
}
}
[ClientRpc]
public void MakeCatSitClientRpc(bool sit)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_007d: 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_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3921800473u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sit, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3921800473u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
animator.SetBool("sit", sit);
isSitting = sit;
}
}
}
[ServerRpc(RequireOwnership = false)]
public void SetCatMaterialServerRpc(int index)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2046492207u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2046492207u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetCatMaterialClientRpc(index);
}
}
}
[ClientRpc]
public void SetCatMaterialClientRpc(int index)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3875721248u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3875721248u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)skinnedMeshRenderer != (Object)null)
{
((Renderer)skinnedMeshRenderer).sharedMaterial = materials[index];
}
}
}
[ServerRpc(RequireOwnership = false)]
public void SetCatNameServerRpc(string name)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00ba: 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.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3049925245u, val, (RpcDelivery)0);
bool flag = name != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
}
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3049925245u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetCatNameClientRpc(name);
}
}
[ClientRpc]
public void SetCatNameClientRpc(string name)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1321450034u, val, (RpcDelivery)0);
bool flag = name != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1321450034u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((Component)this).GetComponentInChildren<ScanNodeProperties>().headerText = "Cat (" + name + ")";
}
}
[ServerRpc(RequireOwnership = false)]
public void SetCatIdleAnimationServerRpc(int index)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1770904636u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1770904636u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetCatIdleAnimationClientRpc(index);
}
}
}
[ClientRpc]
public void SetCatIdleAnimationClientRpc(int index)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(283245169u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 283245169u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
animator.SetInteger("idleAnimation", index);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void SetCatSitAnimationServerRpc(int index)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1062797608u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1062797608u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetCatSitAnimationClientRpc(index);
}
}
}
[ClientRpc]
public void SetCatSitAnimationClientRpc(int index)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4162097660u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4162097660u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
animator.SetInteger("sitAnimation", index);
}
}
}
public virtual void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
if (base.isHeld || base.isHeldByEnemy || noiseID == 8881 || noiseID == 75 || noiseID == 5 || noiseID == 94 || base.isInShipRoom || !StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
return;
}
Vector3 val = noisePosition - ((Component)this).transform.position;
if (!(((Vector3)(ref val)).magnitude < 5f) || !(noiseLoudness > 0.8f))
{
return;
}
PlayCatNoise(fleeSFX);
if (((NetworkBehaviour)this).IsServer)
{
Vector3 position = ((Component)this).transform.position - ((Vector3)(ref val)).normalized * 20f;
GameObject[] array = allAINodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray();
SetDestinationToPosition(array[0].transform.position);
agent.speed = RunningSpeed;
timeBeforeNextMove = Random.Range(IntervalMove.x + 1f, IntervalMove.y + 2f);
}
}
[CompilerGenerated]
[DebuggerHidden]
private void <>n__0(int saveData)
{
((GrabbableObject)this).LoadItemSaveData(saveData);
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_NeedyCatProp()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Expected O, but got Unknown
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Expected O, but got Unknown
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3454429685u, new RpcReceiveHandler(__rpc_handler_3454429685));
NetworkManager.__rpc_func_table.Add(1946573138u, new RpcReceiveHandler(__rpc_handler_1946573138));
NetworkManager.__rpc_func_table.Add(2532932337u, new RpcReceiveHandler(__rpc_handler_2532932337));
NetworkManager.__rpc_func_table.Add(3642870494u, new RpcReceiveHandler(__rpc_handler_3642870494));
NetworkManager.__rpc_func_table.Add(2708699245u, new RpcReceiveHandler(__rpc_handler_2708699245));
NetworkManager.__rpc_func_table.Add(2784153610u, new RpcReceiveHandler(__rpc_handler_2784153610));
NetworkManager.__rpc_func_table.Add(2302897036u, new RpcReceiveHandler(__rpc_handler_2302897036));
NetworkManager.__rpc_func_table.Add(2411027775u, new RpcReceiveHandler(__rpc_handler_2411027775));
NetworkManager.__rpc_func_table.Add(3921800473u, new RpcReceiveHandler(__rpc_handler_3921800473));
NetworkManager.__rpc_func_table.Add(2046492207u, new RpcReceiveHandler(__rpc_handler_2046492207));
NetworkManager.__rpc_func_table.Add(3875721248u, new RpcReceiveHandler(__rpc_handler_3875721248));
NetworkManager.__rpc_func_table.Add(3049925245u, new RpcReceiveHandler(__rpc_handler_3049925245));
NetworkManager.__rpc_func_table.Add(1321450034u, new RpcReceiveHandler(__rpc_handler_1321450034));
NetworkManager.__rpc_func_table.Add(1770904636u, new RpcReceiveHandler(__rpc_handler_1770904636));
NetworkManager.__rpc_func_table.Add(283245169u, new RpcReceiveHandler(__rpc_handler_283245169));
NetworkManager.__rpc_func_table.Add(1062797608u, new RpcReceiveHandler(__rpc_handler_1062797608));
NetworkManager.__rpc_func_table.Add(4162097660u, new RpcReceiveHandler(__rpc_handler_4162097660));
}
private static void __rpc_handler_3454429685(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;
((NeedyCatProp)(object)target).MakeCatMeowServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1946573138(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)2;
((NeedyCatProp)(object)target).MakeCatMeowClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2532932337(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)2;
((NeedyCatProp)(object)target).MakeCatFleeClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3642870494(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;
((NeedyCatProp)(object)target).StopCatFleeServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2708699245(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)2;
((NeedyCatProp)(object)target).StopCatFleeClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2784153610(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((NeedyCatProp)(object)target).MakeCatCalmServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2302897036(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)2;
((NeedyCatProp)(object)target).MakeCatCalmClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2411027775(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0082: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
bool sit = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sit, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((NeedyCatProp)(object)target).MakeCatSitServerRpc(sit);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3921800473(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_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool sit = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sit, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((NeedyCatProp)(object)target).MakeCatSitClientRpc(sit);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2046492207(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 catMaterialServerRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref catMaterialServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((NeedyCatProp)(object)target).SetCatMaterialServerRpc(catMaterialServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3875721248(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 catMaterialClientRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref catMaterialClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)2;
((NeedyCatProp)(object)target).SetCatMaterialClientRpc(catMaterialClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3049925245(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_0061: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string catNameServerRpc = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref catNameServerRpc, false);
}
target.__rpc_exec_stage = (__RpcExecStage)1;
((NeedyCatProp)(object)target).SetCatNameServerRpc(catNameServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1321450034(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_0061: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string catNameClientRpc = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref catNameClientRpc, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((NeedyCatProp)(object)target).SetCatNameClientRpc(catNameClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1770904636(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 catIdleAnimationServerRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref catIdleAnimationServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((NeedyCatProp)(object)target).SetCatIdleAnimationServerRpc(catIdleAnimationServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_283245169(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 catIdleAnimationClientRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref catIdleAnimationClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)2;
((NeedyCatProp)(object)target).SetCatIdleAnimationClientRpc(catIdleAnimationClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1062797608(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 catSitAnimationServerRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref catSitAnimationServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)1;
((NeedyCatProp)(object)target).SetCatSitAnimationServerRpc(catSitAnimationServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4162097660(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 catSitAnimationClientRpc = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref catSitAnimationClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)2;
((NeedyCatProp)(object)target).SetCatSitAnimationClientRpc(catSitAnimationClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "NeedyCatProp";
}
}
public class NoiseListenerRedirect : MonoBehaviour, INoiseListener
{
private INoiseListener target;
public void Awake()
{
target = ((Component)((Component)this).transform.parent).GetComponent<INoiseListener>();
}
public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
INoiseListener obj = target;
if (obj != null)
{
obj.DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
}
}
}
[BepInPlugin("Jordo.NeedyCats", "Needy Cats", "1.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class NeedyCatsBase : BaseUnityPlugin
{
public static class Assets
{
public static string mainAssetBundleName = "needycats";
public static AssetBundle MainAssetBundle = null;
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0];
}
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
private const string modGUID = "Jordo.NeedyCats";
private const string modName = "Needy Cats";
private const string modVersion = "1.2.2";
private readonly Harmony harmony = new Harmony("Jordo.NeedyCats");
public static NeedyCatsBase Instance;
private static List<(string, int)> catNames = new List<(string, int)>();
private static ConfigEntry<int> spawnRate;
private static ConfigEntry<string> catNamesConfig;
public ConfigEntry<bool> CatFoodSilence;
public ConfigEntry<float> CatFleeDogsChance;
public List<CatFoodProp> AllCatFoods = new List<CatFoodProp>();
internal static ManualLogSource mls;
private string defaultCatNames = "One:Stripes,Bella,Tigger,Chloe,Shadow,Luna,Oreo,Oliver,Kitty,Lucy,Molly,Jasper,Smokey,Gizmo,Simba,Tiger,Charlie,Angel,Jack,Lily,Peanut,Toby,Baby,Loki,Midnight,Milo,Princess,Sophie,Harley,Max,Missy,Rocky,Zoe,CoCo,Misty,Nala,Oscar,Pepper,Sasha,Buddy,Pumpkin,Kiki,Mittens,Bailey,Callie,Lucky,Patches:Spots,Simon,Garfield:Orange,George,Maggie,Sammy,Sebastian,Boots,Cali,Felix,Lilly,Phoebe,Sassy,Tucker,Bandit,Dexter,Fiona,Jake,Precious,Romeo,Snickers,Socks,Daisy,Gracie,Lola,Sadie,Sox,Casper,Fluffy,Marley,Minnie,Sweetie,Ziggy,Belle,Blackie,Chester,Frankie,Ginger,Muffin,Murphy,Rusty,Scooter,Batman,Boo,Cleo,Izzy,Jasmine,Mimi,Sugar,Cupcake,Dusty,Leo,Noodle,Panda,Peaches";
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Jordo.NeedyCats");
PatchNetcode();
Assets.PopulateAssets();
spawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("NeedyCats", "Spawn rate", 20, "[Server-side] Sets the cat's spawn rate (This affects all moons).");
CatFoodSilence = ((BaseUnityPlugin)this).Config.Bind<bool>("NeedyCats", "Cat food behaviour", false, "[Server-side] What behaviour will the cat food have on the cats?\nIf false, delays the meows by a significant amount (default, recommended for multiplayer),\nIf true, silences all meows (recommended for solo play).");
CatFleeDogsChance = ((BaseUnityPlugin)this).Config.Bind<float>("NeedyCats", "Chance of cats fleeing dogs", 15f, "[Server-side] When a cat is actively attacked by one or multiple dogs, it has a chance to flee away from the dog.");
catNamesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("NeedyCats", "Cat names", defaultCatNames, "[Server-side] Possible cat names separated by a colon (,). If the cat's name is followed by ':', you can input a material that'll be forced for that name among the following: Black, White, Spots, Boots, Orange, Stripes. You can find an image showcasing each material on the mod's wiki on Thunderstore. This list must contain at least one name. Example string: 'Daisy,Garfield:Orange,Chloe'");
string[] array = catNamesConfig.Value.Split(new char[1] { ',' });
foreach (string text in array)
{
string[] array2 = text.Split(new char[1] { ':' });
catNames.Add((array2[0], (array2.Length > 1) ? GetMaterialID(array2[1]) : (-1)));
}
harmony.PatchAll(typeof(NeedyCatsBase));
mls.LogInfo((object)"Initialized Needy Cats");
}
private int GetMaterialID(string name)
{
return name.ToLower() switch
{
"black" => 0,
"white" => 1,
"boots" => 2,
"spots" => 3,
"orange" => 4,
"stripes" => 5,
_ => -1,
};
}
private void PatchNetcode()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
[HarmonyPostfix]
private static void AddNeedyCatsToNetworkManager(GameNetworkManager __instance)
{
GameObject[] array = Assets.MainAssetBundle.LoadAllAssets<GameObject>();
foreach (GameObject val in array)
{
((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(val);
}
mls.LogInfo((object)"Added NeedyCats prefabs to Network Manager.");
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void AddNeedyCatsToItems(StartOfRound __instance)
{
Item val = Assets.MainAssetBundle.LoadAsset<Item>("CatItem");
Item val2 = Assets.MainAssetBundle.LoadAsset<Item>("CatFoodItem");
Item[] array = Assets.MainAssetBundle.LoadAllAssets<Item>();
foreach (Item item in array)
{
if (!__instance.allItemsList.itemsList.Contains(item))
{
__instance.allItemsList.itemsList.Add(item);
}
}
mls.LogInfo((object)"Added NeedyCats items to items list.");
}
[HarmonyPatch(typeof(Terminal), "Awake")]
[HarmonyPrefix]
private static void AddNeedyCatsToTerminal(Terminal __instance)
{
TerminalKeyword buyKeyword = __instance.terminalNodes.allKeywords.First((TerminalKeyword x) => x.word == "buy");
AddItemToTerminal("CatFoodItem", "CatFoodKeyword", "BuyCatFoodNode", "ConfirmCatFoodNode");
void AddItemToTerminal(string itemName, string keywordName, string buyNodeName, string confirmNodeName)
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
Item item = Assets.MainAssetBundle.LoadAsset<Item>(itemName);
TerminalKeyword keyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>(keywordName);
keyword.defaultVerb = buyKeyword;
TerminalNode val = Assets.MainAssetBundle.LoadAsset<TerminalNode>(buyNodeName);
TerminalNode val2 = Assets.MainAssetBundle.LoadAsset<TerminalNode>(confirmNodeName);
List<TerminalKeyword> list = __instance.terminalNodes.allKeywords.ToList();
if (!list.Contains(keyword))
{
list.Add(keyword);
}
__instance.terminalNodes.allKeywords = list.ToArray();
List<CompatibleNoun> list2 = buyKeyword.compatibleNouns.ToList();
if (((IEnumerable<CompatibleNoun>)list2).FirstOrDefault((Func<CompatibleNoun, bool>)((CompatibleNoun x) => (Object)(object)x.noun == (Object)(object)keyword)) == null)
{
list2.Add(new CompatibleNoun
{
noun = keyword,
result = val
});
}
buyKeyword.compatibleNouns = list2.ToArray();
List<Item> list3 = __instance.buyableItemsList.ToList();
if (!list3.Contains(item))
{
list3.Add(item);
}
__instance.buyableItemsList = list3.ToArray();
val.buyItemIndex = (val2.buyItemIndex = __instance.buyableItemsList.Length - 1);
}
}
[HarmonyPatch(typeof(RoundManager), "Start")]
[HarmonyPostfix]
private static void AddNeedyCatsToAllLevels(RoundManager __instance)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
Item item = Assets.MainAssetBundle.LoadAsset<Item>("CatItem");
SpawnableItemWithRarity val = new SpawnableItemWithRarity();
val.rarity = spawnRate.Value;
val.spawnableItem = item;
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val2 in levels)
{
if (!val2.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)item))
{
val2.spawnableScrap.Add(val);
}
}
mls.LogInfo((object)"Added NeedyCats to all levels.");
}
[HarmonyPatch(typeof(HoarderBugAI), "GrabTargetItemIfClose")]
[HarmonyPrefix]
private static bool GrabTargetItemIfClose(HoarderBugAI __instance)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
float num = ((__instance.targetItem is NeedyCatProp) ? 1f : 0.75f);
if ((Object)(object)__instance.targetItem != (Object)null && __instance.heldItem == null && Vector3.Distance(((Component)__instance).transform.position, ((Component)__instance.targetItem).transform.position) < num)
{
if (!((EnemyAI)__instance).SetDestinationToPosition(__instance.nestPosition, true))
{
__instance.nestPosition = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position;
((EnemyAI)__instance).SetDestinationToPosition(__instance.nestPosition, false);
}
NetworkObject component = ((Component)__instance.targetItem).GetComponent<NetworkObject>();
((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(1);
__instance.GrabItem(component);
__instance.sendingGrabOrDropRPC = true;
__instance.GrabItemServerRpc(NetworkObjectReference.op_Implicit(component));
return true;
}
return false;
}
[HarmonyPatch(typeof(NeedyCatProp), "Awake")]
[HarmonyPrefix]
private static void AddNeedyCatsNames(NeedyCatProp __instance)
{
__instance.CatNames = catNames.ToArray();
}
}
}