Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Zora Enemy v1.0.4
Zora.dll
Decompiled 3 months agousing 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.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Empress.KittyCurse; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Zora")] [assembly: AssemblyTitle("Zora")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.ZoraStare { public class ZoraEventRouter : MonoBehaviourPunCallbacks, IOnEventCallback { public enum Ev : byte { Spawn = 41, Pose, Despawn, SpawnRoll, Glitch } private static bool _callbackHooked; private static GameObject _active; private static ZoraStareController _ctrl; private static GameObject _prefab; internal static void SetPrefab(GameObject prefab) { _prefab = prefab; } private void OnEnable() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; if (_callbackHooked) { PhotonNetwork.RemoveCallbackTarget((object)this); } _callbackHooked = false; } public override void OnJoinedRoom() { EnsureCallbackHooked(); } public override void OnLeftRoom() { if (_callbackHooked) { PhotonNetwork.RemoveCallbackTarget((object)this); _callbackHooked = false; } LocalDespawn(); } private void OnSceneLoaded(Scene s, LoadSceneMode m) { LocalDespawn(); if (PhotonNetwork.InRoom) { EnsureCallbackHooked(); } } private void EnsureCallbackHooked() { if (!_callbackHooked) { PhotonNetwork.AddCallbackTarget((object)this); _callbackHooked = true; } } internal static void BroadcastSpawnRoll(bool passed, float chance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { object[] array = new object[2] { passed, chance }; PhotonNetwork.RaiseEvent((byte)44, (object)array, new RaiseEventOptions { Receivers = (ReceiverGroup)1 }, SendOptions.SendReliable); } } internal static void BroadcastSpawn(Vector3 pos, Quaternion rot, int visionMask) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown CreateLocal(pos, rot, visionMask); if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { object[] array = new object[3] { pos, rot, visionMask }; PhotonNetwork.RaiseEvent((byte)41, (object)array, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } } internal static void BroadcastPose(Vector3 pos, Quaternion rot) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_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_004b: Expected O, but got Unknown if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { object[] array = new object[2] { pos, rot }; PhotonNetwork.RaiseEvent((byte)42, (object)array, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendUnreliable); } } internal static void BroadcastDespawn() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown LocalDespawn(); if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { PhotonNetwork.RaiseEvent((byte)43, (object)null, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } } internal static void BroadcastGlitch(float duration, int seed) { //IL_0039: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown LocalStartGlitch(duration, seed); if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { object[] array = new object[2] { duration, seed }; PhotonNetwork.RaiseEvent((byte)45, (object)array, new RaiseEventOptions { Receivers = (ReceiverGroup)0 }, SendOptions.SendReliable); } } private static void CreateLocal(Vector3 pos, Quaternion rot, int visionMask) { //IL_0024: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_active) && !((Object)(object)_prefab == (Object)null)) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val, 4f, -1)) { pos = ((NavMeshHit)(ref val)).position; } _active = Object.Instantiate<GameObject>(_prefab, pos, rot); ((Object)_active).name = "ZoraStare_Ender"; NavMeshAgent component = _active.GetComponent<NavMeshAgent>(); if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).enabled) { component.Warp(pos); component.stoppingDistance = 1.2f; component.speed = 1.4f; component.acceleration = 8f; component.angularSpeed = 360f; component.autoBraking = true; } _ctrl = _active.GetComponent<ZoraStareController>(); if (Object.op_Implicit((Object)(object)_ctrl)) { _ctrl.Setup(LayerMask.op_Implicit(visionMask)); } } } private static void LocalDespawn() { if (Object.op_Implicit((Object)(object)_active)) { Object.Destroy((Object)(object)_active); } _active = null; _ctrl = null; } private static void LocalStartGlitch(float duration, int seed) { if ((Object)(object)_ctrl != (Object)null) { _ctrl.StartGlitch(duration, seed); } } public void OnEvent(EventData e) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) try { switch ((Ev)e.Code) { case Ev.Spawn: if (!KittyManager.IsAuthority() && e.CustomData is object[] array3 && array3.Length >= 3) { Vector3 pos = (Vector3)array3[0]; Quaternion rot = (Quaternion)array3[1]; int visionMask = (int)array3[2]; CreateLocal(pos, rot, visionMask); } break; case Ev.Pose: if (!KittyManager.IsAuthority() && !((Object)(object)_ctrl == (Object)null) && e.CustomData is object[] array2 && array2.Length >= 2) { _ctrl.ApplyNetworkPose((Vector3)array2[0], (Quaternion)array2[1]); } break; case Ev.Despawn: LocalDespawn(); break; case Ev.SpawnRoll: break; case Ev.Glitch: if (e.CustomData is object[] array && array.Length >= 2) { LocalStartGlitch((float)array[0], (int)array[1]); } break; } } catch { } } } [RequireComponent(typeof(NavMeshAgent))] [DisallowMultipleComponent] public class ZoraStareController : MonoBehaviour { [CompilerGenerated] private sealed class <SpinAndExplode>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ZoraStareController <>4__this; private float <t>5__1; private float <spin>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpinAndExplode>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._exploding) { return false; } <>4__this._exploding = true; if (Object.op_Implicit((Object)(object)<>4__this._agent)) { <>4__this._agent.isStopped = true; } <t>5__1 = 0f; <spin>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<t>5__1 < 2f) { <spin>5__2 += 720f * Time.deltaTime; ((Component)<>4__this).transform.Rotate(Vector3.up, <spin>5__2 * Time.deltaTime, (Space)0); <t>5__1 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } ZoraEventRouter.BroadcastDespawn(); Object.Destroy((Object)(object)((Component)<>4__this).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private NavMeshAgent _agent; private PlayerAvatar _target; private LayerMask _visionMask; private float _poseSendTimer; private const float PoseSendInterval = 0.2f; private Vector3 _netPos; private Quaternion _netRot; private bool _hasNetPose; private const float PoseSnapDist = 5f; private const float PoseLerpRate = 10f; private const float LookDotThreshold = 0.96f; private const float KillRadius = 1.2f; private const float MoveSpeed = 1.4f; private bool _exploding; private Animator _anim; private Vector3 _lastAnimPos; private float _nextGlitchAt; private bool _glitching; private float _glitchEnd; private float _glitchStart; private float _glitchIntensity; private Random _rng; private Renderer[] _renderers; private Vector3 _baseScale; private AudioSource _glitchAudio; private bool _targetLocked; public void Setup(LayerMask visionMask) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) _visionMask = visionMask; } private void Awake() { //IL_0053: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) _agent = ((Component)this).GetComponent<NavMeshAgent>(); if (Object.op_Implicit((Object)(object)_agent)) { _agent.stoppingDistance = 1.2f; _agent.speed = 1.4f; } _anim = ((Component)this).GetComponent<Animator>(); _lastAnimPos = ((Component)this).transform.position; _renderers = ((Component)this).GetComponentsInChildren<Renderer>(true); _baseScale = ((Component)this).transform.localScale; _glitchAudio = ((Component)this).GetComponent<AudioSource>(); } private void Start() { if (!KittyManager.IsAuthority() && Object.op_Implicit((Object)(object)_agent) && ((Behaviour)_agent).enabled) { ((Behaviour)_agent).enabled = false; } _nextGlitchAt = Time.time + Random.Range(ZoraStarePlugin.GlitchMinInterval.Value, ZoraStarePlugin.GlitchMaxInterval.Value); if (KittyManager.IsAuthority() && !_targetLocked) { IReadOnlyList<PlayerAvatar> source = KittyManager.AllPlayersCached(); PlayerAvatar val = (from p in source where Object.op_Implicit((Object)(object)p) orderby Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position) select p).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val)) { _target = val; _targetLocked = true; } } } private void Update() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) if (KittyManager.IsAuthority()) { HostTick(); if (KittyManager.CanStreamPose()) { _poseSendTimer += Time.deltaTime; if (_poseSendTimer >= 0.2f) { _poseSendTimer = 0f; ZoraEventRouter.BroadcastPose(((Component)this).transform.position, ((Component)this).transform.rotation); } } if (!_glitching && Time.time >= _nextGlitchAt) { float num = Mathf.Min(ZoraStarePlugin.GlitchMinDuration.Value, ZoraStarePlugin.GlitchMaxDuration.Value); float num2 = Mathf.Max(ZoraStarePlugin.GlitchMinDuration.Value, ZoraStarePlugin.GlitchMaxDuration.Value); float duration = Random.Range(num, num2); int seed = Random.Range(int.MinValue, int.MaxValue); StartGlitch(duration, seed); ZoraEventRouter.BroadcastGlitch(duration, seed); float num3 = Mathf.Min(ZoraStarePlugin.GlitchMinInterval.Value, ZoraStarePlugin.GlitchMaxInterval.Value); float num4 = Mathf.Max(ZoraStarePlugin.GlitchMinInterval.Value, ZoraStarePlugin.GlitchMaxInterval.Value); _nextGlitchAt = Time.time + Random.Range(num3, num4); } } else { ClientTick(); } if (Object.op_Implicit((Object)(object)_anim)) { bool enabled = false; Vector3 val; if (KittyManager.IsAuthority()) { if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh) { int num5; if (!_agent.isStopped) { val = _agent.velocity; num5 = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? 1 : 0); } else { num5 = 0; } enabled = (byte)num5 != 0; } } else { val = ((Component)this).transform.position - _lastAnimPos; enabled = ((Vector3)(ref val)).sqrMagnitude > 0.0001f; } ((Behaviour)_anim).enabled = enabled; _lastAnimPos = ((Component)this).transform.position; } if (!_glitching) { return; } float num6 = Time.time - _glitchStart; float num7 = 1f + (float)(_rng.NextDouble() * 2.0 - 1.0) * 0.06f * _glitchIntensity; ((Component)this).transform.localScale = _baseScale * num7; bool enabled2 = ((int)(num6 * 60f) & 1) == 0; for (int i = 0; i < _renderers.Length; i++) { if (Object.op_Implicit((Object)(object)_renderers[i])) { _renderers[i].enabled = enabled2; } } if (Time.time >= _glitchEnd) { EndGlitch(); } } private void HostTick() { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (_exploding) { return; } IReadOnlyList<PlayerAvatar> readOnlyList = KittyManager.AllPlayersCached(); bool flag = false; for (int i = 0; i < readOnlyList.Count; i++) { PlayerAvatar val = readOnlyList[i]; if (Object.op_Implicit((Object)(object)val) && PlayerLookingAtMe(val)) { flag = true; } } if ((Object)(object)_target == (Object)null && !_targetLocked && readOnlyList.Count > 0) { PlayerAvatar val2 = (from p in readOnlyList where Object.op_Implicit((Object)(object)p) orderby Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position) select p).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val2)) { _target = val2; _targetLocked = true; } } if ((Object)(object)_target != (Object)null) { Vector3 position = ((Component)_target).transform.position; Vector3 val3 = position - ((Component)this).transform.position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude > 0.0001f) { Quaternion val4 = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val4, Time.deltaTime * 6f); } } if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh) { if (flag) { _agent.isStopped = true; } else { _agent.isStopped = false; if ((Object)(object)_target != (Object)null) { _agent.speed = 1.4f; _agent.acceleration = 8f; _agent.angularSpeed = 360f; _agent.SetDestination(((Component)_target).transform.position); } } } if ((Object)(object)_target != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)_target).transform.position) <= 1.25f) { TryKill(_target); ((MonoBehaviour)this).StartCoroutine(SpinAndExplode()); } } private bool PlayerLookingAtMe(PlayerAvatar player) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) Transform val = null; try { val = (((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform : null); } catch { } if ((Object)(object)val == (Object)null) { val = ((Component)player).transform; } Vector3 val2 = ((Component)this).transform.position + Vector3.up * 1f - val.position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= 0.0001f) { return true; } val2 /= magnitude; float num = Vector3.Dot(val.forward, val2); if (num < 0.96f) { return false; } RaycastHit val3 = default(RaycastHit); if (Physics.Linecast(val.position, ((Component)this).transform.position + Vector3.up * 1f, ref val3, LayerMask.op_Implicit(_visionMask))) { PlayerAvatar componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent == (Object)(object)player) { return true; } return false; } return true; } [IteratorStateMachine(typeof(<SpinAndExplode>d__32))] private IEnumerator SpinAndExplode() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpinAndExplode>d__32(0) { <>4__this = this }; } private void DoExplosion() { //IL_0031: 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) IReadOnlyList<PlayerAvatar> readOnlyList = KittyManager.AllPlayersCached(); float num = 6f; for (int i = 0; i < readOnlyList.Count; i++) { PlayerAvatar val = readOnlyList[i]; if (Object.op_Implicit((Object)(object)val) && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= num) { TryKill(val); } } } private void TryKill(PlayerAvatar player) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)player == (Object)null) { return; } if ((Object)(object)player.playerHealth != (Object)null) { player.playerHealth.HurtOther(999, ((Component)player).transform.position, true, -1); return; } PlayerHealth playerHealth = player.playerHealth; if (playerHealth != null) { playerHealth.Hurt(999, true, -1); } } catch { } } public void ApplyNetworkPose(Vector3 pos, Quaternion rot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) _netPos = pos; _netRot = rot; _hasNetPose = true; } private void ClientTick() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0071: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (_hasNetPose) { if (Vector3.Distance(((Component)this).transform.position, _netPos) > 5f) { ((Component)this).transform.SetPositionAndRotation(_netPos, _netRot); return; } ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, _netPos, Time.deltaTime * 10f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, _netRot, Time.deltaTime * 10f); } } public void StartGlitch(float duration, int seed) { if (!(duration <= 0f)) { _glitching = true; _glitchStart = Time.time; _glitchEnd = Time.time + duration; _glitchIntensity = Mathf.Max(0.1f, ZoraStarePlugin.GlitchIntensity.Value); _rng = new Random(seed); AudioClip glitchClip = ZoraStarePlugin.GlitchClip; if ((Object)(object)glitchClip != (Object)null && (Object)(object)_glitchAudio != (Object)null) { float num = Mathf.Max(0f, glitchClip.length - duration); float num2 = ((num <= 0f) ? 0f : ((float)_rng.NextDouble() * num)); _glitchAudio.clip = glitchClip; _glitchAudio.time = Mathf.Clamp(num2, 0f, Mathf.Max(0f, glitchClip.length - 0.01f)); _glitchAudio.Play(); } } } private void EndGlitch() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) _glitching = false; ((Component)this).transform.localScale = _baseScale; for (int i = 0; i < _renderers.Length; i++) { if (Object.op_Implicit((Object)(object)_renderers[i])) { _renderers[i].enabled = true; } } if (Object.op_Implicit((Object)(object)_glitchAudio) && _glitchAudio.isPlaying) { _glitchAudio.Stop(); } } } [BepInPlugin("empress.repo.zorastare", "ZoraStare", "1.1.2")] public class ZoraStarePlugin : BaseUnityPlugin { [HarmonyPatch(typeof(ZoraStareController), "TryKill")] private static class Patch_Zora_TryKill { [HarmonyPostfix] private static void Postfix() { _spawnKillAchieved = true; } } [CompilerGenerated] private sealed class <DespawnIfNoKill>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public ZoraStarePlugin <>4__this; private float <end>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DespawnIfNoKill>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <end>5__1 = Time.time + seconds; break; case 1: <>1__state = -1; break; } if (Time.time < <end>5__1) { if (_spawnKillAchieved) { return false; } <>2__current = null; <>1__state = 1; return true; } if (KittyManager.IsAuthority()) { ZoraEventRouter.BroadcastDespawn(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitLevelThenSpawn>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ZoraStarePlugin <>4__this; private float <t>5__1; private float <chance>5__2; private bool <pass>5__3; private Transform <tSpawn>5__4; private Vector3 <pos>5__5; private Quaternion <rot>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitLevelThenSpawn>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <tSpawn>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._spawnRoutineRunning || <>4__this._spawnedThisScene) { return false; } <>4__this._spawnRoutineRunning = true; <t>5__1 = 0f; goto IL_00c2; case 1: <>1__state = -1; goto IL_00c2; case 2: <>1__state = -1; goto IL_014c; case 3: { <>1__state = -1; break; } IL_014c: if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { if (<t>5__1 >= 30f) { <>4__this._spawnRoutineRunning = false; return false; } <t>5__1 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 2; return true; } <t>5__1 = 0f; break; IL_00c2: if (BlockedMenuOrHub()) { if (<t>5__1 >= 30f) { <>4__this._spawnRoutineRunning = false; return false; } <t>5__1 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 1; return true; } <t>5__1 = 0f; if (!PhotonNetwork.InRoom && PhotonNetwork.IsConnected) { <>4__this._spawnRoutineRunning = false; return false; } goto IL_014c; } if (!NavMeshReady()) { if (<t>5__1 >= 30f) { <>4__this._spawnRoutineRunning = false; return false; } <t>5__1 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 3; return true; } if (!KittyManager.IsAuthority()) { <>4__this._spawnRoutineRunning = false; return false; } if ((Object)(object)_enderPrefab == (Object)null) { <>4__this._spawnRoutineRunning = false; return false; } <chance>5__2 = Mathf.Clamp01(SpawnChance?.Value ?? 1f); <pass>5__3 = Random.value <= <chance>5__2; if (PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady) { ZoraEventRouter.BroadcastSpawnRoll(<pass>5__3, <chance>5__2); } if (!<pass>5__3) { <>4__this._spawnRoutineRunning = false; <>4__this._spawnedThisScene = false; return false; } <tSpawn>5__4 = PickRandomSpawnPoint(); <pos>5__5 = <tSpawn>5__4.position + Vector3.up * 0.2f; <rot>5__6 = <tSpawn>5__4.rotation; ZoraEventRouter.BroadcastSpawn(<pos>5__5, <rot>5__6, ((LayerMask)(ref VisionMask)).value); _spawnKillAchieved = false; ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DespawnIfNoKill(180f)); <>4__this._spawnedThisScene = true; <>4__this._spawnRoutineRunning = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "empress.repo.zorastare"; public const string PluginName = "ZoraStare"; public const string PluginVersion = "1.1.2"; internal static ManualLogSource Log; private Harmony _harmony; private static AssetBundle _bundle; private static GameObject _enderPrefab; internal static ConfigEntry<float> SpawnChance; internal static ConfigEntry<float> GlitchMinInterval; internal static ConfigEntry<float> GlitchMaxInterval; internal static ConfigEntry<float> GlitchMinDuration; internal static ConfigEntry<float> GlitchMaxDuration; internal static ConfigEntry<float> GlitchIntensity; internal static ConfigEntry<float> GlitchVolume; internal static AudioClip GlitchClip; private bool _spawnRoutineRunning; private bool _spawnedThisScene; private static bool _spawnKillAchieved; public static LayerMask VisionMask = LayerMask.op_Implicit(-1); private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("empress.repo.zorastare"); _harmony.PatchAll(typeof(ZoraStarePlugin).Assembly); SpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn", "SpawnChance", 0.05f, new ConfigDescription("Chance [0..1] that Zora spawns per playable level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); GlitchMinInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Glitch", "MinInterval", 8f, new ConfigDescription("Seconds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 120f), Array.Empty<object>())); GlitchMaxInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Glitch", "MaxInterval", 16f, new ConfigDescription("Seconds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 180f), Array.Empty<object>())); GlitchMinDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Glitch", "MinDuration", 0.15f, new ConfigDescription("Seconds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 5f), Array.Empty<object>())); GlitchMaxDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Glitch", "MaxDuration", 0.6f, new ConfigDescription("Seconds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 8f), Array.Empty<object>())); GlitchIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Glitch", "Intensity", 1f, new ConfigDescription("0.2=soft, 1.0=default, 2.0=aggressive", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>())); GlitchVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Glitch", "Volume", 0.9f, new ConfigDescription("0..1", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); LoadBundle(); GameObject val = new GameObject("ZoraStare_RouterHost"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)52; ZoraEventRouter zoraEventRouter = val.AddComponent<ZoraEventRouter>(); ZoraEventRouter.SetPrefab(_enderPrefab); LoadGlitchAudioWav(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void OnSceneLoaded(Scene s, LoadSceneMode m) { _spawnRoutineRunning = false; _spawnedThisScene = false; ((MonoBehaviour)this).StopAllCoroutines(); if (PhotonNetwork.InRoom || !PhotonNetwork.IsConnected) { ((MonoBehaviour)this).StartCoroutine(WaitLevelThenSpawn()); } } [IteratorStateMachine(typeof(<WaitLevelThenSpawn>d__22))] private IEnumerator WaitLevelThenSpawn() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitLevelThenSpawn>d__22(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<DespawnIfNoKill>d__23))] private IEnumerator DespawnIfNoKill(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DespawnIfNoKill>d__23(0) { <>4__this = this, seconds = seconds }; } private static bool BlockedMenuOrHub() { try { RunManager instance = RunManager.instance; Level val = instance?.levelCurrent; if ((Object)(object)instance == (Object)null || (Object)(object)val == (Object)null) { return true; } string text = SafeLower(val.NarrativeName); string text2 = SafeLower(val.ResourcePath); if (text.Contains("lobby menu") || text2.Contains("lobby menu")) { return true; } if (text.Contains("main menu") || text2.Contains("main menu")) { return true; } if (text.Contains("splash screen") || text.Contains("splash")) { return true; } if (text.Contains("shop") || text2.Contains("shop") || text2.Contains("store")) { return true; } if (text.Contains("lobby") || text2.Contains("lobby")) { return true; } if (text.Contains("arena") || text2.Contains("arena")) { return true; } if (text2.Contains("/menu/")) { return true; } return false; } catch { return true; } } private static string SafeLower(string s) { return (s ?? string.Empty).Trim().ToLowerInvariant(); } private static bool NavMeshReady() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) NavMeshTriangulation val = NavMesh.CalculateTriangulation(); return val.vertices != null && val.vertices.Length != 0 && val.indices != null && val.indices.Length != 0; } private static Transform PickRandomSpawnPoint() { //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) LevelGenerator instance = LevelGenerator.Instance; if ((Object)(object)instance != (Object)null && instance.Generated && instance.LevelPathPoints != null && instance.LevelPathPoints.Count > 0) { List<Transform> list = new List<Transform>(instance.LevelPathPoints.Count); for (int i = 0; i < instance.LevelPathPoints.Count; i++) { LevelPoint val = instance.LevelPathPoints[i]; if (!((Object)(object)val == (Object)null)) { list.Add(((Component)val).transform); } } if ((Object)(object)instance.LevelPathTruck != (Object)null) { Vector3 position = ((Component)instance.LevelPathTruck).transform.position; for (int j = 1; j < list.Count; j++) { Transform val2 = list[j]; float num = Vector3.Distance(position, val2.position); int num2 = j - 1; while (num2 >= 0 && Vector3.Distance(position, list[num2].position) > num) { list[num2 + 1] = list[num2]; num2--; } list[num2 + 1] = val2; } int num3 = Mathf.Min(3, list.Count); int num4 = 0; for (int k = num3; k < list.Count; k++) { if (Vector3.Distance(position, list[k].position) > 6f) { list[num4++] = list[k]; } } if (num4 > 0) { list.RemoveRange(num4, list.Count - num4); } } if (list.Count > 0) { return list[Random.Range(0, list.Count)]; } } SpawnPoint[] array = Object.FindObjectsOfType<SpawnPoint>(); if (array == null || array.Length == 0) { GameObject val3 = new GameObject("ZoraStare_SpawnFallback"); val3.transform.position = Vector3.up; return val3.transform; } return ((Component)array[Random.Range(0, array.Length)]).transform; } private void LoadBundle() { if ((Object)(object)_bundle != (Object)null) { return; } try { string text = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); if (string.IsNullOrEmpty(text)) { text = Paths.PluginPath; } string[] array = Directory.GetFiles(text, "zora", SearchOption.TopDirectoryOnly).Concat(Directory.GetFiles(text, "zora.*", SearchOption.TopDirectoryOnly)).ToArray(); string[] array2 = array; foreach (string text2 in array2) { try { _bundle = AssetBundle.LoadFromFile(text2); if (!Object.op_Implicit((Object)(object)_bundle)) { continue; } _enderPrefab = _bundle.LoadAsset<GameObject>("ender"); if (!Object.op_Implicit((Object)(object)_enderPrefab)) { continue; } AudioSource[] componentsInChildren = _enderPrefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { val.spatialBlend = 1f; val.dopplerLevel = 0f; val.rolloffMode = (AudioRolloffMode)0; val.minDistance = 8f; val.maxDistance = 20f; } } if (!Object.op_Implicit((Object)(object)_enderPrefab.GetComponent<NavMeshAgent>())) { _enderPrefab.AddComponent<NavMeshAgent>(); } if (!Object.op_Implicit((Object)(object)_enderPrefab.GetComponent<ZoraStareController>())) { _enderPrefab.AddComponent<ZoraStareController>(); } Log.LogInfo((object)("Loaded AssetBundle at " + text2 + " with ender prefab.")); return; } catch (Exception ex) { Log.LogWarning((object)("Failed to load bundle at " + text2 + ": " + ex.Message)); } } Log.LogWarning((object)"No 'zora' AssetBundle found beside the plugin .dll. Place it next to the .dll."); } catch (Exception arg) { Log.LogError((object)$"LoadBundle failed: {arg}"); } } private void LoadGlitchAudioWav() { try { string text = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); if (string.IsNullOrEmpty(text)) { text = Paths.PluginPath; } string[] files = Directory.GetFiles(text, "*.wav", SearchOption.TopDirectoryOnly); if (files.Length == 0) { return; } string path = files.FirstOrDefault((string f) => Path.GetFileName(f).ToLowerInvariant().Contains("glitch")) ?? files[0]; if (!File.Exists(path)) { return; } byte[] array = File.ReadAllBytes(path); if (array.Length < 44) { return; } int num = 0; string @string = Encoding.ASCII.GetString(array, num, 4); num += 4; int num2 = BitConverter.ToInt32(array, num); num += 4; string string2 = Encoding.ASCII.GetString(array, num, 4); num += 4; if (@string != "RIFF" || string2 != "WAVE") { return; } int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = -1; int num8 = 0; while (num + 8 <= array.Length) { string string3 = Encoding.ASCII.GetString(array, num, 4); num += 4; int num9 = BitConverter.ToInt32(array, num); num += 4; if (string3 == "fmt ") { num6 = BitConverter.ToInt16(array, num); num3 = BitConverter.ToInt16(array, num + 2); num4 = BitConverter.ToInt32(array, num + 4); num5 = BitConverter.ToInt16(array, num + 14); num += num9; continue; } if (string3 == "data") { num7 = num; num8 = num9; break; } num += num9; } if (num7 < 0 || num3 <= 0 || num4 <= 0) { return; } if (num6 == 1 && num5 == 16) { int num10 = num8 / 2; int num11 = num10 / num3; float[] array2 = new float[num11 * num3]; int num12 = 0; for (int i = 0; i < num10; i++) { short num13 = BitConverter.ToInt16(array, num7 + i * 2); array2[num12++] = (float)num13 / 32768f; } AudioClip val = AudioClip.Create("ZoraGlitch", num11, num3, num4, false); val.SetData(array2, 0); GlitchClip = val; } else if (num6 == 3 && num5 == 32) { int num14 = num8 / 4; int num15 = num14 / num3; float[] array3 = new float[num15 * num3]; Buffer.BlockCopy(array, num7, array3, 0, num8); AudioClip val2 = AudioClip.Create("ZoraGlitch", num15, num3, num4, false); val2.SetData(array3, 0); GlitchClip = val2; } } catch { } } } } namespace Empress.KittyCurse { [RequireComponent(typeof(NavMeshAgent))] [DisallowMultipleComponent] public class KittyCatController : MonoBehaviour { private enum State { Patrol, Pursue, Ask, KillAll } [CompilerGenerated] private sealed class <AskSequence>d__49 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerAvatar player; public KittyCatController <>4__this; private int <i>5__1; private float <t>5__2; private float <end>5__3; private float <t2>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AskSequence>d__49(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_01e9: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this._state == State.Ask) { return false; } <>4__this._state = State.Ask; <>4__this.IdleAnim(); <i>5__1 = 0; goto IL_026a; case 1: <>1__state = -1; goto IL_00eb; case 2: <>1__state = -1; goto IL_0234; case 3: { <>1__state = -1; goto IL_02e9; } IL_00eb: if (<t>5__2 < <>4__this._askGrace) { if (<>4__this.GiftSatisfied(player)) { <>4__this.OnGiftAccepted(); return false; } <t>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } if (<i>5__1 < 2) { <end>5__3 = Time.time + <>4__this._askInterval; goto IL_0234; } goto IL_0257; IL_026a: if (<i>5__1 < 3) { if (KittyManager.IsAuthority()) { KittyEventRouter.BroadcastVoice(Mathf.Clamp(<i>5__1, 0, 2)); } <t>5__2 = 0f; goto IL_00eb; } if (!KittyManager.IsAuthority()) { break; } <t2>5__4 = 0f; goto IL_02e9; IL_0257: <i>5__1++; goto IL_026a; IL_0234: if (Time.time < <end>5__3) { if (Object.op_Implicit((Object)(object)<>4__this._agent) && <>4__this._agent.isOnNavMesh) { <>4__this._agent.isStopped = false; <>4__this._agent.speed = 4.2f; <>4__this._repathTimer -= Time.deltaTime; if (<>4__this._repathTimer <= 0f) { <>4__this._repathTimer = 0.2f; <>4__this._agent.SetDestination(((Component)player).transform.position); } } if (<>4__this.GiftSatisfied(player)) { <>4__this.OnGiftAccepted(); return false; } <>2__current = null; <>1__state = 2; return true; } <>4__this.IdleAnim(); goto IL_0257; IL_02e9: if (<t2>5__4 < <>4__this._askGrace) { if (<>4__this.GiftSatisfied(player)) { <>4__this.OnGiftAccepted(); return false; } <t2>5__4 += Time.deltaTime; <>2__current = null; <>1__state = 3; return true; } <>4__this.StartKillEveryoneMode(); break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WanderOffAndDie>d__53 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public KittyCatController <>4__this; private Vector3 <best>5__1; private float <bestScore>5__2; private IReadOnlyList<PlayerAvatar> <players>5__3; private float <end>5__4; private int <i>5__5; private Vector3 <cand>5__6; private NavMeshHit <hit>5__7; private float <score>5__8; private int <p>5__9; private PlayerAvatar <av>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WanderOffAndDie>d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <players>5__3 = null; <av>5__10 = null; <>1__state = -2; } private bool MoveNext() { //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_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_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_01f9: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <best>5__1 = ((Component)<>4__this).transform.position; <bestScore>5__2 = float.NegativeInfinity; <players>5__3 = KittyManager.AllPlayersCached(); <i>5__5 = 0; while (<i>5__5 < 16) { <cand>5__6 = ((Component)<>4__this).transform.position + Random.insideUnitSphere * 45f; if (NavMesh.SamplePosition(<cand>5__6, ref <hit>5__7, 6f, -1)) { <score>5__8 = 0f; <p>5__9 = 0; while (<p>5__9 < <players>5__3.Count) { <av>5__10 = <players>5__3[<p>5__9]; if (Object.op_Implicit((Object)(object)<av>5__10)) { <score>5__8 += Vector3.Distance(((NavMeshHit)(ref <hit>5__7)).position, ((Component)<av>5__10).transform.position); } <av>5__10 = null; <p>5__9++; } if (<score>5__8 > <bestScore>5__2) { <bestScore>5__2 = <score>5__8; <best>5__1 = ((NavMeshHit)(ref <hit>5__7)).position; } } <i>5__5++; } if (Object.op_Implicit((Object)(object)<>4__this._agent) && <>4__this._agent.isOnNavMesh) { <>4__this._agent.isStopped = false; <>4__this._agent.speed = 3.8f; <>4__this._agent.SetDestination(<best>5__1); } <end>5__4 = Time.time + 10f; break; case 1: <>1__state = -1; break; } if (Time.time < <end>5__4) { <>2__current = null; <>1__state = 1; return true; } <>4__this.ToggleMusicLocal(on: false); KittyEventRouter.BroadcastDespawn(); Object.Destroy((Object)(object)((Component)<>4__this).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private NavMeshAgent _agent; private Animator _anim; private AudioSource _voice; private AudioSource _music; private AudioClip[] _voiceClips; private AudioClip _musicClip; private float _voiceVol = 1f; private float _musicVol = 0.5f; private float _patrolRadius; private float _engageDistance; private LayerMask _visionMask; private float _askGrace; private float _askInterval; private Transform[] _levelPoints; private Transform _truckPoint; private Transform _currentPatrolTarget; private float _idleUntil; private bool _movingToPatrol; private float _repathTimer; private Vector3 _lastPos; private float _stuckTimer; private PlayerAvatar _target; private State _state = State.Patrol; private float _scanTimer; private float _poseSendTimer; private const float PoseSendInterval = 0.2f; private Vector3 _netPos; private Quaternion _netRot; private bool _hasNetPose; private const float PoseSnapDist = 5f; private const float PoseLerpRate = 10f; private float _postGiftCooldownUntil; private bool _hasCatIdleTrigger; private bool _hasWalkBool; private Vector3 _animLastPos; private float _killRepathTimer; private static readonly List<PlayerAvatar> _victimsTmp = new List<PlayerAvatar>(8); public void Setup(float patrolRadius, float engageDistance, LayerMask visionMask, float askGrace, float askInterval) { //IL_0010: 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) _patrolRadius = patrolRadius; _engageDistance = engageDistance; _visionMask = visionMask; _askGrace = Mathf.Max(10f, askGrace); _askInterval = Mathf.Max(_askGrace, askInterval); } public void AssignAudio(AudioClip[] voices, AudioClip music, float voiceVol, float musicVol) { _voiceClips = voices ?? Array.Empty<AudioClip>(); _musicClip = music; _voiceVol = Mathf.Clamp01(voiceVol); _musicVol = Mathf.Clamp01(musicVol); } public void ApplyNetworkPose(Vector3 pos, Quaternion rot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) _netPos = pos; _netRot = rot; _hasNetPose = true; } private void Awake() { _agent = ((Component)this).GetComponent<NavMeshAgent>(); _anim = ((Component)this).GetComponent<Animator>(); _voice = ((Component)this).GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>(); _voice.playOnAwake = false; _voice.loop = false; _voice.spatialBlend = 1f; _voice.dopplerLevel = 0f; _voice.rolloffMode = (AudioRolloffMode)0; _voice.minDistance = 8f; _voice.maxDistance = 18f; _music = ((Component)this).gameObject.AddComponent<AudioSource>(); _music.playOnAwake = false; _music.loop = true; _music.spatialBlend = 1f; _music.dopplerLevel = 0f; _music.rolloffMode = (AudioRolloffMode)0; _music.minDistance = 12f; _music.maxDistance = 30f; if (Object.op_Implicit((Object)(object)_agent)) { _agent.stoppingDistance = 1.5f; } } private void OnEnable() { KittyManager.Register(this); } private void OnDisable() { KittyManager.Unregister(this); } private void Start() { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Invalid comparison between Unknown and I4 //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Invalid comparison between Unknown and I4 LevelGenerator instance = LevelGenerator.Instance; if ((Object)(object)instance != (Object)null && instance.Generated) { _truckPoint = (Object.op_Implicit((Object)(object)instance.LevelPathTruck) ? ((Component)instance.LevelPathTruck).transform : null); if (instance.LevelPathPoints != null) { _levelPoints = (from p in instance.LevelPathPoints where (Object)(object)p != (Object)null select ((Component)p).transform).ToArray(); } } _idleUntil = Time.time + Random.Range(10f, 30f); _lastPos = ((Component)this).transform.position; _animLastPos = ((Component)this).transform.position; if ((Object)(object)_anim != (Object)null) { for (int i = 0; i < _anim.parameterCount; i++) { AnimatorControllerParameter parameter = _anim.GetParameter(i); if (parameter.name == "catidle" && (int)parameter.type == 9) { _hasCatIdleTrigger = true; } if (parameter.name == "Walk" && (int)parameter.type == 4) { _hasWalkBool = true; } } } if (!KittyManager.IsAuthority() && Object.op_Implicit((Object)(object)_agent) && ((Behaviour)_agent).enabled) { ((Behaviour)_agent).enabled = false; } } private void Update() { //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_00fd: 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) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (KittyManager.IsAuthority()) { HostTick(); if (KittyManager.CanStreamPose()) { _poseSendTimer += Time.deltaTime; if (_poseSendTimer >= 0.2f) { _poseSendTimer = 0f; KittyEventRouter.BroadcastPose(((Component)this).transform.position, ((Component)this).transform.rotation); } } } else { ClientTick(); } if (!Object.op_Implicit((Object)(object)_anim) || !_hasWalkBool) { return; } bool flag = false; Vector3 val; if (KittyManager.IsAuthority()) { if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh) { int num; if (!_agent.isStopped) { val = _agent.velocity; num = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? 1 : 0); } else { num = 0; } flag = (byte)num != 0; } } else { val = ((Component)this).transform.position - _animLastPos; flag = ((Vector3)(ref val)).sqrMagnitude > 0.0001f; } _anim.SetBool("Walk", flag); _animLastPos = ((Component)this).transform.position; } private void HostTick() { _scanTimer -= Time.deltaTime; if (_scanTimer <= 0f) { _scanTimer = 0.33f; ScanForTargets(); } switch (_state) { case State.Patrol: PatrolTick(); break; case State.Pursue: PursueTick(); break; case State.Ask: break; case State.KillAll: KillAllTick(); break; } } private void ScanForTargets() { //IL_006d: 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 (Time.time < _postGiftCooldownUntil || _state == State.Ask || _state == State.KillAll) { return; } IReadOnlyList<PlayerAvatar> readOnlyList = KittyManager.AllPlayersCached(); PlayerAvatar val = null; float num = float.PositiveInfinity; for (int i = 0; i < readOnlyList.Count; i++) { PlayerAvatar val2 = readOnlyList[i]; if (Object.op_Implicit((Object)(object)val2)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 <= _engageDistance && num2 < num && HasLineOfSight(val2)) { val = val2; num = num2; } } } if ((Object)(object)val != (Object)null) { _target = val; _state = State.Pursue; } } private void PursueTick() { //IL_00a7: 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_0095: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_target == (Object)null) { _state = State.Patrol; } else if (Object.op_Implicit((Object)(object)_agent) && _agent.isOnNavMesh) { _agent.isStopped = false; _repathTimer -= Time.deltaTime; if (_repathTimer <= 0f) { _repathTimer = 0.15f; _agent.SetDestination(((Component)_target).transform.position); } if (Vector3.Distance(((Component)this).transform.position, ((Component)_target).transform.position) <= 4f) { ((MonoBehaviour)this).StartCoroutine(AskSequence(_target)); } } } [IteratorStateMachine(typeof(<AskSequence>d__49))] private IEnumerator AskSequence(PlayerAvatar player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AskSequence>d__49(0) { <>4__this = this, player = player }; } private void IdleAnim() { if (Object.op_Implicit((Object)(object)_agent)) { _agent.isStopped = true; } if (Object.op_Implicit((Object)(object)_anim) && _hasCatIdleTrigger) { _anim.SetTrigger("catidle"); } if (Object.op_Implicit((Object)(object)_anim) && _hasWalkBool) { _anim.SetBool("Walk", false); } } private bool GiftSatisfied(PlayerAvatar player) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (KittyManager.IsAuthority()) { return KittyManager.AnyRecentDropNear(((Component)this).transform.position, _askGrace, 6f); } return false; } private void OnGiftAccepted() { _target = null; _state = State.Patrol; if (Object.op_Implicit((Object)(object)_agent)) { _agent.speed = 3.5f; _agent.isStopped = false; } _postGiftCooldownUntil = Time.time + 15f; ((MonoBehaviour)this).StartCoroutine(WanderOffAndDie()); } [IteratorStateMachine(typeof(<WanderOffAndDie>d__53))] private IEnumerator WanderOffAndDie() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WanderOffAndDie>d__53(0) { <>4__this = this }; } private bool HasLineOfSight(PlayerAvatar player) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_006f: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player)) { return false; } Vector3 val = ((Component)this).transform.position + Vector3.up * 1.2f; Transform val2 = null; try { val2 = (((Object)(object)player.PlayerVisionTarget != (Object)null) ? player.PlayerVisionTarget.VisionTransform : null); } catch { } Vector3 val3 = (((Object)(object)val2 != (Object)null) ? val2.position : ((Component)player).transform.position); RaycastHit val4 = default(RaycastHit); if (Physics.Linecast(val, val3, ref val4, LayerMask.op_Implicit(_visionMask))) { return (Object)(object)((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<PlayerAvatar>() == (Object)(object)player; } return true; } private void PatrolTick() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_agent) || !_agent.isOnNavMesh) { return; } if (_movingToPatrol) { if (!_agent.pathPending && _agent.remainingDistance <= 0.5f) { _movingToPatrol = false; _idleUntil = Time.time + Random.Range(10f, 30f); _agent.isStopped = true; return; } Vector3 val = ((Component)this).transform.position - _lastPos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; _stuckTimer = ((sqrMagnitude < 0.0004f) ? (_stuckTimer + Time.deltaTime) : 0f); _lastPos = ((Component)this).transform.position; if (_stuckTimer > 2f) { _stuckTimer = 0f; ForceNextPatrolDestination(); } } else if (Time.time < _idleUntil) { if (!_agent.isStopped) { _agent.isStopped = true; } } else { ForceNextPatrolDestination(); } } private void ForceNextPatrolDestination() { //IL_00a8: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0068: 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_0091: Unknown result type (might be due to invalid IL or missing references) _agent.isStopped = false; _currentPatrolTarget = ChooseNextLevelPoint(); if ((Object)(object)_currentPatrolTarget != (Object)null) { Vector3 position = _currentPatrolTarget.position; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val, 3f, -1)) { position = ((NavMeshHit)(ref val)).position; } if (_agent.isOnNavMesh) { _agent.SetDestination(position); } else { _agent.Warp(position); } _movingToPatrol = true; _lastPos = ((Component)this).transform.position; _stuckTimer = 0f; return; } Vector3 val2 = Random.insideUnitSphere * _patrolRadius + ((Component)this).transform.position; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(val2, ref val3, _patrolRadius, -1)) { if (_agent.isOnNavMesh) { _agent.SetDestination(((NavMeshHit)(ref val3)).position); } else { _agent.Warp(((NavMeshHit)(ref val3)).position); } } _movingToPatrol = true; _lastPos = ((Component)this).transform.position; _stuckTimer = 0f; } private Transform ChooseNextLevelPoint() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (_levelPoints == null || _levelPoints.Length == 0) { return null; } Vector3 position = ((Component)this).transform.position; Transform val = null; float num = float.NegativeInfinity; for (int i = 0; i < _levelPoints.Length; i++) { Transform val2 = _levelPoints[i]; if ((Object)(object)val2 == (Object)null || ((Object)(object)_truckPoint != (Object)null && Vector3.Distance(val2.position, _truckPoint.position) <= 6f)) { continue; } float num2 = Vector3.Distance(val2.position, position); if (!(num2 <= 12f)) { float num3 = num2; if (num3 > num) { num = num3; val = val2; } } } if ((Object)(object)val != (Object)null) { return val; } return _levelPoints[Random.Range(0, _levelPoints.Length)]; } private void TryKill(PlayerAvatar player) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)player == (Object)null) { return; } if ((Object)(object)player.playerHealth != (Object)null) { player.playerHealth.HurtOther(999, ((Component)player).transform.position, true, -1); return; } PlayerHealth playerHealth = player.playerHealth; if (playerHealth != null) { playerHealth.Hurt(999, true, -1); } } catch { } } private void StartKillEveryoneMode() { _state = State.KillAll; if (Object.op_Implicit((Object)(object)_agent)) { _agent.isStopped = false; _agent.speed = 9f; _agent.acceleration = 20f; _agent.angularSpeed = 720f; } if (KittyManager.IsAuthority()) { KittyEventRouter.BroadcastMusic(on: true); } } private void KillAllTick() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_agent) || !_agent.isOnNavMesh) { return; } _victimsTmp.Clear(); IReadOnlyList<PlayerAvatar> readOnlyList = KittyManager.AllPlayersCached(); for (int i = 0; i < readOnlyList.Count; i++) { PlayerAvatar val = readOnlyList[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.playerHealth) && ((Component)val.playerHealth).gameObject.activeInHierarchy) { _victimsTmp.Add(val); } } if (_victimsTmp.Count == 0) { return; } PlayerAvatar val2 = null; float num = float.PositiveInfinity; for (int j = 0; j < _victimsTmp.Count; j++) { PlayerAvatar val3 = _victimsTmp[j]; float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position); if (num2 < num) { num = num2; val2 = val3; } } if ((Object)(object)val2 != (Object)null) { _agent.isStopped = false; _killRepathTimer -= Time.deltaTime; if (_killRepathTimer <= 0f) { _killRepathTimer = 0.12f; _agent.SetDestination(((Component)val2).transform.position); } if (num <= 3.2f && KittyManager.IsAuthority()) { TryKill(val2); } } } internal void PlayVoiceLocal(int index) { if (!((Object)(object)_voice == (Object)null) && _voiceClips != null && _voiceClips.Length != 0) { int num = Mathf.Clamp(index, 0, _voiceClips.Length - 1); AudioClip val = _voiceClips[num]; if (Object.op_Implicit((Object)(object)val)) { _voice.volume = _voiceVol; _voice.PlayOneShot(val); } } } internal void ToggleMusicLocal(bool on) { if ((Object)(object)_music == (Object)null || (Object)(object)_musicClip == (Object)null) { return; } if (on) { if ((Object)(object)_music.clip != (Object)(object)_musicClip) { _music.clip = _musicClip; } _music.volume = _musicVol; if (!_music.isPlaying) { _music.Play(); } } else if (_music.isPlaying) { _music.Stop(); } } private void ClientTick() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0071: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (_hasNetPose) { if (Vector3.Distance(((Component)this).transform.position, _netPos) > 5f) { ((Component)this).transform.SetPositionAndRotation(_netPos, _netRot); return; } ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, _netPos, Time.deltaTime * 10f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, _netRot, Time.deltaTime * 10f); } } } public static class KittyEventRouter { public static void BroadcastPose(Vector3 pos, Quaternion rot) { } public static void BroadcastDespawn() { } public static void BroadcastMusic(bool on) { } public static void BroadcastVoice(int index) { } } public static class KittyManager { private struct DropRec { public float t; public Vector3 pos; } private static readonly List<KittyCatController> _cats = new List<KittyCatController>(); private static readonly Dictionary<int, (float t, Vector3 pos)> _playerDrop = new Dictionary<int, (float, Vector3)>(); private static readonly DropRec[] _recentDrops = new DropRec[16]; private static int _recentDropsHead; private static readonly List<PlayerAvatar> _playersCache = new List<PlayerAvatar>(8); private static float _playersNextRefresh; private const float PlayersRefreshInterval = 1f; public static void Register(KittyCatController c) { if ((Object)(object)c != (Object)null && !_cats.Contains(c)) { _cats.Add(c); } } public static void Unregister(KittyCatController c) { if ((Object)(object)c != (Object)null) { _cats.Remove(c); } } public static bool IsAuthority() { return !GameManager.Multiplayer() || PhotonNetwork.IsMasterClient; } public static bool CanStreamPose() { return PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady && IsAuthority(); } public static bool AnyCatNear(Vector3 where, float withinMeters) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _cats.Count; i++) { KittyCatController kittyCatController = _cats[i]; if (Object.op_Implicit((Object)(object)kittyCatController) && Vector3.Distance(where, ((Component)kittyCatController).transform.position) <= withinMeters) { return true; } } return false; } public static void NoteValuableDropped(PlayerAvatar avatar, Vector3 where) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)avatar)) { _playerDrop[((Object)avatar).GetInstanceID()] = (Time.time, where); } } public static void NoteValuableDroppedNet(Vector3 where, float time) { //IL_0035: 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) int num = _recentDropsHead++ & (_recentDrops.Length - 1); _recentDrops[num].t = time; _recentDrops[num].pos = where; } public static bool AnyRecentDropNear(Vector3 where, float withinSeconds, float withinMeters) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float num = withinMeters * withinMeters; for (int i = 0; i < _recentDrops.Length; i++) { float num2 = time - _recentDrops[i].t; if (num2 > 0f && num2 <= withinSeconds) { Vector3 val = where - _recentDrops[i].pos; if (((Vector3)(ref val)).sqrMagnitude <= num) { return true; } } } return false; } public static bool PlayerDroppedValuableNear(PlayerAvatar avatar, Vector3 where, float withinSeconds, float withinMeters) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)avatar)) { return false; } if (_playerDrop.TryGetValue(((Object)avatar).GetInstanceID(), out (float, Vector3) value) && Time.time - value.Item1 <= withinSeconds) { return Vector3.Distance(value.Item2, where) <= withinMeters; } return false; } public static IReadOnlyList<PlayerAvatar> AllPlayersCached() { if (Time.unscaledTime >= _playersNextRefresh) { _playersCache.Clear(); PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); if (array != null) { foreach (PlayerAvatar val in array) { if (Object.op_Implicit((Object)(object)val)) { _playersCache.Add(val); } } } _playersNextRefresh = Time.unscaledTime + 1f; } return _playersCache; } } }