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 The Projection v1.0.3
cunningfox146.liza.dll
Decompiled 2 years 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 BepInEx; using BepInEx.Logging; using CunningFox146.Core; using CunningFox146.Core.BehaviourTrees; using CunningFox146.Core.States; using CunningFox146.Core.Utils; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using LizaPlugin.AssetManagement; using LizaPlugin.Components; using LizaPlugin.Components.Hat; using LizaPlugin.Components.Liza; using LizaPlugin.Components.Liza.States; using LizaPlugin.Patches; using LizaPlugin.Services; using LizaPlugin.Util; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Pool; using UnityEngine.Rendering.HighDefinition; using UnityEngine.VFX; using cunningfox146.liza.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("cunningfox146.liza")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+610aad4a6f43c072d54c8c2806ad6886940bfc80")] [assembly: AssemblyProduct("LizaPlugin")] [assembly: AssemblyTitle("cunningfox146.liza")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 CunningFox146.Core { public static class ServiceLocator { private static class SingleRegistration<T> where T : IService { public static T Implementation { get; set; } } public static void RegisterSingle<TService, TContract>(TService service) where TService : TContract where TContract : IService { SingleRegistration<TService>.Implementation = service; } public static void RegisterSingle<TService>(TService service) where TService : IService { SingleRegistration<TService>.Implementation = service; } public static TContract ResolveSingle<TContract>() where TContract : IService { return SingleRegistration<TContract>.Implementation; } } public interface IService { } } namespace CunningFox146.Core.Utils { public static class AudioUtils { public static IEnumerator SoundsLoopCoroutine(this AudioSource source, List<AudioClip> clips) { return Enumerator(); IEnumerator Enumerator() { while (((Behaviour)source).enabled) { AudioClip val = clips[Random.Range(0, clips.Count)]; source.clip = val; source.Play(); yield return (object)new WaitForSeconds(val.length); } } } } public class DisposableToken : IDisposable { [CompilerGenerated] private Action <disposeAction>P; public DisposableToken(Action disposeAction) { <disposeAction>P = disposeAction; base..ctor(); } public void Dispose() { GC.SuppressFinalize(this); PerformDisposing(); } ~DisposableToken() { PerformDisposing(); } private void PerformDisposing() { <disposeAction>P?.Invoke(); <disposeAction>P = null; } } public static class ListExtensions { public static void Resize<T>(this List<T> list, int size, T defaultItem = default(T)) { int count = list.Count; if (size < count) { list.RemoveRange(size, count - size); } else if (size > count) { if (size > list.Capacity) { list.Capacity = size; } list.AddRange(Enumerable.Repeat(defaultItem, size - count)); } } } public static class MonoBehaviourExtensions { public static Coroutine Delay(this MonoBehaviour monoBehaviour, float delay, Action action) { return monoBehaviour.StartCoroutine(DelayCoroutine()); IEnumerator DelayCoroutine() { object obj = (object)/*Error near IL_001e: stateMachine*/; obj = (object)((!(delay > 0f)) ? ((WaitForSeconds)null) : new WaitForSeconds(delay)); ((<>c__DisplayClass0_0.<<Delay>g__DelayCoroutine|0>d)obj).<>2__current = obj; try { /*Error near IL_0047: Unexpected return in MoveNext()*/; } finally { /*Error: Could not find finallyMethod for state=1. Possibly this method is affected by a C# compiler bug that causes the finally body not to run in case of an exception or early 'break;' out of a loop consuming this iterable.*/; } yield break; } } public static Coroutine Tween(this MonoBehaviour monoBehaviour, float from, float to, float duration, Action<float> onUpdate, Action onDone = null, AnimationCurve easingCurve = null) { return monoBehaviour.StartCoroutine(DelayCoroutine()); IEnumerator DelayCoroutine() { float startTime = Time.time; while (Time.time - startTime <= duration) { float num = (Time.time - startTime) / duration; AnimationCurve obj = easingCurve; float num2 = ((obj != null) ? obj.Evaluate(num) : num); float obj2 = Mathf.Lerp(from, to, num2); onUpdate(obj2); yield return null; } onUpdate(to); onDone?.Invoke(); } } } } namespace CunningFox146.Core.States { public interface IState { void OnEnter(); } public interface IStateBlocker { bool IsBlocking { get; } } public interface IStateExit { void OnExit(); } public interface IStateMachine { IState CurrentState { get; } void EnterState<TState>() where TState : IState; } public interface IStateUpdateable { void Update(); } public class NetworkedStateMachine : NetworkBehaviour { private readonly NetworkVariable<int> _currentState = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly List<IState> _states = new List<IState>(); public IState LocalState { get; private set; } public bool IsBlocked { get { if (LocalState is IStateBlocker stateBlocker) { return stateBlocker.IsBlocking; } return false; } } public event Action<IState> StateChange; public override void OnNetworkSpawn() { ((NetworkVariableBase)_currentState).Initialize((NetworkBehaviour)(object)this); NetworkVariable<int> currentState = _currentState; currentState.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)currentState.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnStateChanged)); if (_currentState.Value >= 0) { SetStateInternal(_currentState.Value); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); NetworkVariable<int> currentState = _currentState; currentState.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)currentState.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnStateChanged)); ((NetworkVariableBase)_currentState).Dispose(); } protected virtual void Update() { (LocalState as IStateUpdateable)?.Update(); } public void SetStates(IEnumerable<IState> states) { _states.AddRange(states); } public void SetState<TState>() where TState : IState { IState state = _states.First((IState s) => s is TState); int state2 = _states.IndexOf(state); if (!IsBlocked && LocalState != state) { SetState(state2); } } private void SetState(int idx) { if (((NetworkBehaviour)this).IsOwner) { _currentState.Value = idx; ((NetworkVariableBase)_currentState).SetDirty(true); SetStateInternal(idx); } } protected virtual void SetStateInternal(int stateIdx) { IState state = _states[stateIdx]; if (!IsBlocked && LocalState != state) { this.StateChange?.Invoke(state); (LocalState as IStateExit)?.OnExit(); LocalState = state; LocalState.OnEnter(); } } private void OnStateChanged(int _, int newValue) { if (!((NetworkBehaviour)this).IsOwner) { SetStateInternal(newValue); } } protected override void __initializeVariables() { if (_currentState == null) { throw new Exception("NetworkedStateMachine._currentState cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_currentState).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_currentState, "_currentState"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_currentState); ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetworkedStateMachine"; } } public class TimedEvent { public float Delay { get; set; } public Action DelayedAction { get; set; } public TimedEvent(float delay, Action delayedAction) { Delay = delay; DelayedAction = delayedAction; base..ctor(); } } } namespace CunningFox146.Core.BehaviourTrees { public class BehaviourTree { [CompilerGenerated] private Node <root>P; public BehaviourTree(Node root) { <root>P = root; base..ctor(); } public void Update() { if (<root>P.IsValid) { <root>P.Update(); } } } public class Node { protected static readonly Func<bool> AlwaysTrueFunc = () => true; protected Action UpdateAction { get; set; } protected Func<bool> IsValidFunc { get; set; } public bool IsValid => IsValidFunc(); public Node() { } public Node(Func<bool> isValidFunc, Action updateAction) { IsValidFunc = isValidFunc; UpdateAction = updateAction; } public void Update() { UpdateAction?.Invoke(); } } public class CooldownNode : Node { private readonly float _cooldown; private readonly Action _updateAction; private readonly Func<bool> _isValid; private float _lastUpdateTime = float.MinValue; private bool IsOnCooldown => Time.time - _lastUpdateTime < _cooldown; public CooldownNode(Action updateAction, float cooldown, string name = null) : this(Node.AlwaysTrueFunc, updateAction, cooldown) { } public CooldownNode(Func<bool> isValid, Action updateAction, float cooldown) { _cooldown = cooldown; _updateAction = updateAction; _isValid = isValid; base.IsValidFunc = IsValidInternal; base.UpdateAction = UpdateInternal; } private bool IsValidInternal() { if (!IsOnCooldown) { return _isValid(); } return false; } private void UpdateInternal() { _lastUpdateTime = Time.time; _updateAction(); } } public class PriorityNode : Node { private readonly IEnumerable<Node> _nodes; public PriorityNode(Func<bool> isValidFunc, IEnumerable<Node> nodes) : base(isValidFunc, null) { base.UpdateAction = UpdateInternal; _nodes = nodes; } public PriorityNode(IEnumerable<Node> nodes) : base(Node.AlwaysTrueFunc, null) { base.UpdateAction = UpdateInternal; _nodes = nodes; } private void UpdateInternal() { foreach (Node node in _nodes) { if (node.IsValid) { node.Update(); break; } } } } public class SequentialNode : Node { private readonly IEnumerable<Node> _nodes; public SequentialNode(Func<bool> isValidFunc, IEnumerable<Node> nodes) : base(isValidFunc, null) { base.UpdateAction = UpdateInternal; _nodes = nodes; } private void UpdateInternal() { foreach (Node node in _nodes) { if (!node.IsValid) { break; } node.Update(); } } } public class FallbackNode : Node { public FallbackNode(Action updateAction) : base(Node.AlwaysTrueFunc, updateAction) { } } } namespace LizaPlugin { [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("cunningfox146.liza", "LizaPlugin", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LizaPlugin : BaseUnityPlugin { public static LizaPlugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } private static Harmony Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); PatchNetCode(); RegisterServices(); RegisterHat(); RegisterLizaEnemy(); RegisterRagDoll(); Logger.LogInfo((object)"cunningfox146.liza v1.0.0 has loaded!"); } private static void RegisterServices() { RuntimeAssetProvider runtimeAssetProvider = new RuntimeAssetProvider(); ServiceLocator.RegisterSingle((IAssetProvider)runtimeAssetProvider); LizaDecalService service = new LizaDecalService(runtimeAssetProvider); ServiceLocator.RegisterSingle(service); LizaSpawnService service2 = new LizaSpawnService(); ServiceLocator.RegisterSingle(service2); } private static void RegisterRagDoll() { IAssetProvider assetProvider = ServiceLocator.ResolveSingle<IAssetProvider>(); GameObject lizaRagDoll = assetProvider.LizaRagDoll; Utilities.FixMixerGroups(lizaRagDoll); LizaAI.RagDollIndex = RagDollsExtension.RegisterRagDoll(lizaRagDoll); } private static void RegisterHat() { IAssetProvider assetProvider = ServiceLocator.ResolveSingle<IAssetProvider>(); Item hatItem = assetProvider.HatItem; Items.RegisterItem(hatItem); NetworkPrefabs.RegisterNetworkPrefab(hatItem.spawnPrefab); Utilities.FixMixerGroups(hatItem.spawnPrefab); } private static void RegisterLizaEnemy() { IAssetProvider assetProvider = ServiceLocator.ResolveSingle<IAssetProvider>(); EnemyType lizaEnemyType = assetProvider.LizaEnemyType; NetworkPrefabs.RegisterNetworkPrefab(lizaEnemyType.enemyPrefab); Utilities.FixMixerGroups(lizaEnemyType.enemyPrefab); } private static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("cunningfox146.liza"); } Harmony.PatchAll(); } internal static void Unpatch() { Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private static 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); } } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "cunningfox146.liza"; public const string PLUGIN_NAME = "LizaPlugin"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LizaPlugin.Util { public static class DistanceUtil { public static T GetClosestToPoint<T>(this List<T> items, Vector3 point, Predicate<T> predicate = null) where T : Component { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) T result = default(T); float num = float.MaxValue; foreach (T item in items) { float num2 = Vector3.Distance(((Component)item).transform.position, point); if (num2 < num && (predicate == null || predicate(item))) { result = item; num = num2; } } return result; } } public static class EntranceTeleportUtils { public static void PlayDoorSound(this EntranceTeleport entrance) { if (entrance.doorAudios != null && entrance.doorAudios.Any()) { entrance.entrancePointAudio.PlayOneShot(entrance.doorAudios[0]); WalkieTalkie.TransmitOneShotAudio(entrance.entrancePointAudio, entrance.doorAudios[0], 1f); } } } } namespace LizaPlugin.Services { public class LizaDecalService : IService { private const float DecalLifetime = 15f; private readonly ObjectPool<FadeableDecal> _decals; public LizaDecalService(IAssetProvider assetProvider) { GameObject decalPrefab = assetProvider.LagDecal; _decals = new ObjectPool<FadeableDecal>((Func<FadeableDecal>)(() => Object.Instantiate<GameObject>(decalPrefab).GetComponent<FadeableDecal>()), (Action<FadeableDecal>)delegate(FadeableDecal decal) { decal.FadeIn(); ((Component)decal).gameObject.SetActive(true); }, (Action<FadeableDecal>)delegate(FadeableDecal decal) { decal.FadeOut(destroy: false); }, (Action<FadeableDecal>)null, true, 10, 10000); } public void SpawnDecal(Transform spawnAt) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) SpawnDecal(spawnAt.position, spawnAt.rotation); } public void SpawnDecal(Vector3 spawnAt, Quaternion rotation) { //IL_0029: 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) FadeableDecal decal = _decals.Get(); ((Component)decal).transform.SetPositionAndRotation(spawnAt, rotation); ((MonoBehaviour)(object)decal).Delay(15f, delegate { _decals.Release(decal); }); } } public class LizaSpawnService : IService { private const float KillCooldown = 60f; private readonly List<HatItem> _allHats = new List<HatItem>(); private float _lizaDeathTime = float.MinValue; private LizaAI _currentLiza; private bool IsOnCooldown => Time.time - _lizaDeathTime < 60f; public void RequestLiza(HatItem hat) { if (!NetworkManager.Singleton.IsServer || IsOnCooldown) { return; } RemoveOtherHats(hat); ((MonoBehaviour)(object)hat).Delay(hat.SpawnDelay, delegate { //IL_003e: 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 (_currentLiza == null) { _currentLiza = CreateLiza(GetSpawnPosition(hat)); } _currentLiza.SetHat(new NetworkObjectReference(((Component)hat).GetComponent<NetworkObject>())); }); } private void RemoveOtherHats(HatItem hat) { foreach (HatItem allHat in _allHats) { if ((Object)(object)allHat != (Object)(object)hat) { allHat.DespawnItem(); } } _allHats.Clear(); _allHats.Add(hat); } public void LizaDeath(LizaAI liza, bool ignoreCooldown) { if (!((Object)(object)_currentLiza != (Object)(object)liza)) { _currentLiza = null; if (!ignoreCooldown) { _lizaDeathTime = Time.time; } } } public void RegisterHat(HatItem hat) { _allHats.Add(hat); } private static LizaAI CreateLiza(Vector3 pos) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) IAssetProvider assetProvider = ServiceLocator.ResolveSingle<IAssetProvider>(); GameObject enemyPrefab = assetProvider.LizaEnemyType.enemyPrefab; GameObject val = Object.Instantiate<GameObject>(enemyPrefab, pos, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(true); return val.GetComponent<LizaAI>(); } private static Vector3 GetSpawnPosition(HatItem hat) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)hat).transform.position, -Vector3.up, ref val, 20f, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point; } return ((Component)hat).transform.position; } } } namespace LizaPlugin.Patches { [HarmonyPatch(typeof(RoundManager))] public class HatSpawnPatch { private const int HatsCount = 3; [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPostfix] private static void SpawnScrapInLevelPostfix(RoundManager __instance) { LizaSpawnService lizaSpawnService = ServiceLocator.ResolveSingle<LizaSpawnService>(); for (int i = 0; i < 3; i++) { SpawnHat(__instance, lizaSpawnService); } } private static void SpawnHat(RoundManager round, LizaSpawnService lizaSpawnService) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) RandomScrapSpawn val = ((IEnumerable<RandomScrapSpawn>)Object.FindObjectsOfType<RandomScrapSpawn>()).FirstOrDefault((Func<RandomScrapSpawn, bool>)((RandomScrapSpawn s) => !s.spawnUsed)); if (val == null) { LizaPlugin.Logger.LogWarning((object)"Failed to find free RandomScrapSpawn"); return; } IAssetProvider assetProvider = ServiceLocator.ResolveSingle<IAssetProvider>(); Item hatItem = assetProvider.HatItem; HatItem component = Object.Instantiate<GameObject>(hatItem.spawnPrefab, ((Component)val).transform.position, Quaternion.Euler(hatItem.restingRotation), round.spawnedScrapContainer).GetComponent<HatItem>(); component.IsFromThisMoon = true; ((GrabbableObject)component).fallTime = 0f; ((Component)component).GetComponent<NetworkObject>().Spawn(false); lizaSpawnService.RegisterHat(component); val.spawnUsed = true; } } [HarmonyPatch(typeof(Terminal))] public class LizaTerminalPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void RegisterCustomRagDolls(Terminal __instance) { } } [HarmonyPatch(typeof(StartOfRound))] public class RagDollPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void RegisterCustomRagDolls(StartOfRound __instance) { __instance.playerRagdolls.Resize(RagDollsExtension.CustomRagDolls.Count + 228); for (int i = 0; i < RagDollsExtension.CustomRagDolls.Count; i++) { __instance.playerRagdolls[228 + i] = RagDollsExtension.CustomRagDolls[i]; } } } public static class RagDollsExtension { public const int CustomRagDollsStartIdx = 228; public static readonly List<GameObject> CustomRagDolls = new List<GameObject>(); public static int RegisterRagDoll(GameObject ragDollPrefab) { CustomRagDolls.Add(ragDollPrefab); return 228 + CustomRagDolls.Count - 1; } } } namespace LizaPlugin.Components { public class FadeableDecal : MonoBehaviour { private static readonly int Fade = Shader.PropertyToID("_Fade"); private static readonly int MainTex = Shader.PropertyToID("_MainTex"); [SerializeField] private float _spawnDuration = 0.5f; [SerializeField] private AnimationCurve _spawnCurve; [SerializeField] private AnimationCurve _despawnCurve; [SerializeField] private DecalProjector _projector; [SerializeField] private Texture2D[] _randomTextures; private Material _material; private void OnEnable() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown _material = new Material(_projector.material); _projector.material = _material; _material.SetFloat(Fade, 0f); RandomiseTexture(); } private void RandomiseTexture() { Texture2D[] randomTextures = _randomTextures; if (randomTextures != null && randomTextures.Length > 0) { Texture2D val = _randomTextures[Random.Range(0, _randomTextures.Length)]; _material.SetTexture(MainTex, (Texture)(object)val); } } public void FadeIn() { DoFade(1f, 0f, _spawnDuration, _spawnCurve); } public void FadeOut(bool destroy) { DoFade(0f, 1f, _spawnDuration, _despawnCurve, OnDone); void OnDone() { if (destroy) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { ((Component)this).gameObject.SetActive(false); } } } public void DoFade(float from, float to, float duration, AnimationCurve curve, Action onDone = null) { ((MonoBehaviour)(object)this).Tween(from, to, duration, delegate(float p) { _material.SetFloat(Fade, p); }, onDone, curve); } } public class LagController : MonoBehaviour { private static readonly int IsLagging = Shader.PropertyToID("_IsLagging"); [SerializeField] private Renderer _renderer; [SerializeField] private bool _isLagging; [SerializeField] private Vector2 _lagLength = Vector2.one; [SerializeField] private Vector2 _lagPeriod = Vector2.one * 5f; private Material _material; private Coroutine _lagCoroutine; public event Action LagStart; public event Action LagStop; private void OnEnable() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (_material == null) { _material = new Material(_renderer.material); } _renderer.material = _material; _lagCoroutine = ((MonoBehaviour)this).StartCoroutine(LagCoroutine()); } private void OnDisable() { StopLagCoroutine(); } public void SetLagPeriod(Vector2 lagPeriod) { //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) _lagPeriod = lagPeriod; } public void SetLagLength(Vector2 lagLength) { //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) _lagLength = lagLength; } public void ForceLag() { StopLag(); _renderer.material.SetFloat(IsLagging, 1f); } public void ResetLag() { _renderer.material.SetFloat(IsLagging, 0f); StopLagCoroutine(); _lagCoroutine = ((MonoBehaviour)this).StartCoroutine(LagCoroutine()); } private void StopLagCoroutine() { if (_lagCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_lagCoroutine); } } private IEnumerator LagCoroutine() { while (((Behaviour)this).enabled) { yield return (object)new WaitForSeconds(Random.Range(_lagPeriod.x, _lagPeriod.y)); StartLag(); yield return (object)new WaitForSeconds(Random.Range(_lagLength.x, _lagLength.y)); StopLag(); } } private void StartLag() { this.LagStart?.Invoke(); _renderer.material.SetFloat(IsLagging, 1f); } private void StopLag() { this.LagStop?.Invoke(); _renderer.material.SetFloat(IsLagging, 0f); } } public class LagSfx : MonoBehaviour { [SerializeField] private LagController _controller; [SerializeField] private AudioSource _audioSource; [SerializeField] private List<AudioClip> _lagSounds; private Coroutine _audioCoroutine; private void OnEnable() { _controller.LagStart += OnLagStart; _controller.LagStop += OnLagStop; } private void OnDisable() { _controller.LagStart -= OnLagStart; _controller.LagStop -= OnLagStop; OnLagStop(); } private void OnLagStart() { if (_audioCoroutine == null) { _audioCoroutine = ((MonoBehaviour)this).StartCoroutine(_audioSource.SoundsLoopCoroutine(_lagSounds)); } } private void OnLagStop() { if (_audioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_audioCoroutine); _audioCoroutine = null; } _audioSource.Stop(); } } public class PitchLag : MonoBehaviour { [SerializeField] private AudioSource _audio; [SerializeField] private Vector2 _range = new Vector2(0f, 1.25f); [SerializeField] private float _changeSpeed = 0.15f; [SerializeField] private float _lagLength = 1.1f; private Coroutine _lagCoroutine; private void OnDisable() { StopLag(); } public void StartLag() { _audio.pitch = 1f; StopLag(); ((MonoBehaviour)this).StartCoroutine(LagCoroutine()); } private void StopLag() { if (_lagCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_lagCoroutine); } _lagCoroutine = null; } private IEnumerator LagCoroutine() { float startTime = Time.time; float length = _audio.clip.length; float num = length * Random.Range(0f, 1f); num = Mathf.Clamp(num, 0f, length - _lagLength); yield return (object)new WaitForSeconds(num); while (Time.time - startTime <= _lagLength) { _audio.pitch = Random.Range(_range.x, _range.y); yield return (object)new WaitForSeconds(_changeSpeed); } _audio.pitch = 1f; } } [RequireComponent(typeof(Rigidbody), typeof(Collider))] public class TriggerReporter : MonoBehaviour { private readonly HashSet<Collider> _colliders = new HashSet<Collider>(); public event Action CollisionStart; public event Action CollisionStop; private void OnTriggerEnter(Collider other) { if (_colliders.Count == 0) { this.CollisionStart?.Invoke(); } _colliders.Add(other); } private void OnTriggerExit(Collider other) { _colliders.Remove(other); if (_colliders.Count == 0) { this.CollisionStop?.Invoke(); } } } } namespace LizaPlugin.Components.Liza { public class LizaAI : EnemyAI, INoiseListener, IVisibleThreat { [SerializeField] private float _attackRange = 3f; [SerializeField] private float _attackAoeDistance = 5f; [SerializeField] private float _hearDistance = 15f; [SerializeField] private float _hatPatrolDistance = 7f; [SerializeField] private float _hatPatrolSwitchPeriod = 5f; [SerializeField] private float _loudnessToHear = 0.5f; [SerializeField] private int _damagePerTic = 20; [SerializeField] private float _maxNoTargetTime = 5f; [SerializeField] private float _attackPeriod = 3.5f; [SerializeField] private float _retargetPeriod = 2f; [SerializeField] private LizaStateMachine _stateMachine; [SerializeField] private LizaAnimator _animator; [SerializeField] private LizaVfx _vfx; private BehaviourTree _behaviourTree; private LizaSpawnService _lizaSpawnService; private GrabbableObject _hat; private float _lastPatrolTime; private Vector3 _lastTargetPos; private float _lastTargetTime = float.MaxValue; private Vector3 _patrolPos; private Random _random; private float _lastStunTime; private int _maxHealth; private float _lastAttackTime; private EntranceTeleport _currentInteriorDoor; private List<EntranceTeleport> _allInteriorDoors; private PlayerControllerB _localPlayer; public static int RagDollIndex { get; set; } private bool IsAttackOnCooldown => Time.time - _lastAttackTime < _attackPeriod; public ThreatType type => (ThreatType)3; private void Awake() { PriorityNode root = new PriorityNode(new Node[8] { new Node(IsSpawning, null), new Node(IsDead, EnemyDeath), new Node(ShouldDespawn, Despawn), new Node(IsStunned, BecomeStunned), new PriorityNode(ShouldAttack, new Node[2] { new Node(IsNearTarget, Attack), new FallbackNode(FollowTarget) }), new Node(HasRecentlySeenTarget, MoveTowardsLastTargetPosition), new PriorityNode(ShouldSeekInteriorDoor, new Node[3] { new CooldownNode(SelectInteriorDoor, 5f, "SelectInteriorDoor"), new Node(IsFarFromInteriorDoor, MoveTowardsInteriorDoor), new FallbackNode(UseInteriorDoor) }), new PriorityNode(HasHat, new Node[3] { new Node(IsFarFromHat, MoveTowardsHat), new Node(ShouldSwitchPatrolPoint, SwitchPatrolPoint), new FallbackNode(PatrolHat) }) }); _behaviourTree = new BehaviourTree(root); _lizaSpawnService = ServiceLocator.ResolveSingle<LizaSpawnService>(); } private void SelectInteriorDoor() { if (_allInteriorDoors == null) { EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); List<EntranceTeleport> list = new List<EntranceTeleport>(array.Length); list.AddRange(array); _allInteriorDoors = list; } _currentInteriorDoor = FindClosestInteriorDoor(); if (_currentInteriorDoor == null) { throw new Exception("Failed to find closest door"); } } private EntranceTeleport FindClosestInteriorDoor() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return _allInteriorDoors.GetClosestToPoint<EntranceTeleport>(((Component)this).transform.position, (Predicate<EntranceTeleport>)((EntranceTeleport d) => d.isEntranceToBuilding == base.isOutside)); } private void UseInteriorDoor() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_currentInteriorDoor) && ((NetworkBehaviour)this).IsServer) { UseInteriorDoorInternal(_currentInteriorDoor); UseInteriorDoorClientRpc(NetworkObjectReference.op_Implicit(((Component)_currentInteriorDoor).GetComponent<NetworkObject>())); } } [ClientRpc] private void UseInteriorDoorClientRpc(NetworkObjectReference doorReference) { //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(3343349849u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref doorReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3343349849u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner && ((NetworkObjectReference)(ref doorReference)).TryGet(ref val3, (NetworkManager)null)) { UseInteriorDoorInternal(((Component)val3).GetComponent<EntranceTeleport>()); } } } private void UseInteriorDoorInternal(EntranceTeleport door) { //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_000d: Unknown result type (might be due to invalid IL or missing references) Vector3 position = door.exitPoint.position; Teleport(position); ((EnemyAI)this).SetEnemyOutside(!base.isOutside); RoundManager.FindMainEntranceScript(false)?.PlayDoorSound(); } private void MoveTowardsInteriorDoor() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) base.destination = ((Component)_currentInteriorDoor).transform.position; MoveToDestination(); } private bool IsFarFromInteriorDoor() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)this).transform.position, ((Component)_currentInteriorDoor).transform.position) > 3f; } private void BecomeStunned() { _stateMachine.SetState<StunnedState>(); } private void Despawn() { _stateMachine.SetState<DespawnState>(); } private void EnemyDeath() { if (base.enemyHP <= 0) { _stateMachine.SetState<DeathState>(); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); _localPlayer = GameNetworkManager.Instance.localPlayerController; _random = new Random(StartOfRound.Instance.randomMapSeed); _maxHealth = base.enemyHP; } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost) { OnDespawnInternal(); } else { OnDespawnServerRpc(); } } private void FixedUpdate() { UpdateLocalPlayerSanity(); } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); UpdateTargetPlayer(); _behaviourTree.Update(); } public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) ((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID); if (noiseLoudness >= _loudnessToHear && Vector3.Distance(noisePosition, ((Component)this).transform.position) <= _hearDistance) { SetTargetPosition(noisePosition); } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSfx = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSfx, hitID); if (!base.isEnemyDead && !IsSpawning()) { if (Object.op_Implicit((Object)(object)playerWhoHit)) { base.targetPlayer = playerWhoHit; } base.enemyHP -= force; _animator.SetGlitchPercent(1f - (float)base.enemyHP / (float)_maxHealth); _animator.PlayHit(); _vfx.HitFx(); } } public void Die() { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } else { ((Component)this).gameObject.SetActive(false); } } public void SetHat(NetworkObjectReference networkObjectReference) { //IL_0011: 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) if (((NetworkBehaviour)this).IsServer) { SetHatInternal(networkObjectReference); } else { SetHatClientRpc(networkObjectReference); } } public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 1f, PlayerControllerB setStunnedByPlayer = null) { ((EnemyAI)this).SetEnemyStunned(setToStunned, setToStunTime, setStunnedByPlayer); if (setToStunned) { _lastStunTime = Time.time; } } public void PerformAttack() { if (!IsStunned() && ((NetworkBehaviour)this).IsOwner) { PerformAttackServerRpc(); } } private void UpdateLocalPlayerSanity() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (_localPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 50f, 25, 10f)) { _localPlayer.IncreaseFearLevelOverTime(1f, (_stateMachine.LocalState is AttackState) ? 1f : 0.5f); } } private void PatrolHat() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) base.destination = _patrolPos; MoveToDestination(); } private void SwitchPatrolPoint() { //IL_001c: 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_003c: 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_0044: Unknown result type (might be due to invalid IL or missing references) _lastPatrolTime = Time.time; RoundManager instance = RoundManager.Instance; Vector3 position = ((Component)_hat).transform.position; float num = _hatPatrolDistance - 0.5f; Random random = _random; _patrolPos = instance.GetRandomNavMeshPositionInBoxPredictable(position, num, default(NavMeshHit), random, -1); } private void MoveTowardsLastTargetPosition() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) base.destination = _lastTargetPos; base.moveTowardsDestination = true; } private bool HasRecentlySeenTarget() { return Time.time - _lastTargetTime < 5f; } private void FollowTarget() { MoveToPlayer(); } private void Attack() { Stop(); _lastAttackTime = Time.time; _stateMachine.SetState<AttackState>(); } private void UpdateTargetPlayer() { base.targetPlayer = ((EnemyAI)this).CheckLineOfSightForPlayer(60f, 60, -1); } private void MoveTowardsHat() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) base.destination = ((Component)_hat).transform.position; MoveToDestination(); } [ClientRpc] private void SetHatClientRpc(NetworkObjectReference networkObjectReference) { //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) //IL_00d7: 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(1816520687u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1816520687u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetHatInternal(networkObjectReference); } } } [ServerRpc] private void OnDespawnServerRpc() { //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(721760376u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 721760376u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { OnDespawnInternal(); } } private void OnDespawnInternal() { _lizaSpawnService.LizaDeath(this, ShouldDespawn()); } [ServerRpc] private void PerformAttackServerRpc() { //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(440122716u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 440122716u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PerformAttackClientRpc(); } } [ClientRpc] private void PerformAttackClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) 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(119696605u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 119696605u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (Vector3.Distance(((Component)val3).transform.position, ((Component)this).transform.position) <= _attackAoeDistance) { val3.DamagePlayer(_damagePerTic, true, true, (CauseOfDeath)9, RagDollIndex, false, default(Vector3)); } } } private void SetHatInternal(NetworkObjectReference networkObjectReference) { NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val, (NetworkManager)null)) { _hat = ((Component)val).GetComponent<GrabbableObject>(); } } private void SetTargetPosition(Vector3 pos) { //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) _lastTargetPos = pos; _lastTargetTime = Time.time; } private void MoveToPlayer() { base.movingTowardsTargetPlayer = true; base.moveTowardsDestination = true; } private void MoveToDestination() { base.moveTowardsDestination = true; base.movingTowardsTargetPlayer = false; } private void Stop() { base.moveTowardsDestination = false; base.movingTowardsTargetPlayer = false; } public IDisposable StopMovement() { float speed = base.agent.speed; base.agent.speed = 0f; ((Behaviour)base.agent).enabled = false; return new DisposableToken(delegate { base.agent.speed = speed; ((Behaviour)base.agent).enabled = true; }); } private void Teleport(Vector3 pos) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0028: 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_0030: Unknown result type (might be due to invalid IL or missing references) using (StopMovement()) { Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(pos, default(NavMeshHit), 5f, -1); ((Component)this).transform.position = navMeshPosition; base.serverPosition = navMeshPosition; } } private bool HasHat() { return Object.op_Implicit((Object)(object)_hat); } private bool IsHatOutside() { return !_hat.isInFactory; } private bool ShouldSeekInteriorDoor() { return IsHatOutside() != base.isOutside; } private bool ShouldDespawn() { return Time.time - _lastTargetTime >= _maxNoTargetTime; } private bool IsSpawning() { return _stateMachine.LocalState is SpawnState; } private bool IsDead() { return base.enemyHP <= 0; } private bool ShouldSwitchPatrolPoint() { return Time.time - _lastPatrolTime >= _hatPatrolSwitchPeriod; } private bool IsFarFromHat() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)this).transform.position, ((Component)_hat).transform.position) > _hatPatrolDistance; } private bool ShouldAttack() { if (HasTarget()) { return !IsAttackOnCooldown; } return false; } private bool HasTarget() { if (Object.op_Implicit((Object)(object)base.targetPlayer)) { return ((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, true); } return false; } private bool IsNearTarget() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= _attackRange; } private bool IsStunned() { if (base.stunnedIndefinitely <= 0) { return Time.time - _lastStunTime < base.stunNormalizedTimer; } return true; } public int GetThreatLevel(Vector3 seenByPosition) { if (base.enemyHP < 2) { return 3; } return 5; } public int GetInterestLevel() { return 0; } public int SendSpecialBehaviour(int id) { return 0; } public Transform GetThreatLookTransform() { return base.eye; } public Transform GetThreatTransform() { return ((Component)this).transform; } public Vector3 GetThreatVelocity() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsOwner) { return Vector3.zero; } return base.agent.velocity; } public float GetVisibility() { if (!base.isEnemyDead) { return 1f; } return 0f; } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LizaAI() { //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 NetworkManager.__rpc_func_table.Add(3343349849u, new RpcReceiveHandler(__rpc_handler_3343349849)); NetworkManager.__rpc_func_table.Add(1816520687u, new RpcReceiveHandler(__rpc_handler_1816520687)); NetworkManager.__rpc_func_table.Add(721760376u, new RpcReceiveHandler(__rpc_handler_721760376)); NetworkManager.__rpc_func_table.Add(440122716u, new RpcReceiveHandler(__rpc_handler_440122716)); NetworkManager.__rpc_func_table.Add(119696605u, new RpcReceiveHandler(__rpc_handler_119696605)); } private static void __rpc_handler_3343349849(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_004f: 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) { NetworkObjectReference doorReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref doorReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LizaAI)(object)target).UseInteriorDoorClientRpc(doorReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1816520687(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_004f: 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) { NetworkObjectReference hatClientRpc = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref hatClientRpc, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LizaAI)(object)target).SetHatClientRpc(hatClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_721760376(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; ((LizaAI)(object)target).OnDespawnServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_440122716(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; ((LizaAI)(object)target).PerformAttackServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_119696605(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; ((LizaAI)(object)target).PerformAttackClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LizaAI"; } } public class LizaAnimator : NetworkBehaviour { private static readonly int VelocityParam = Animator.StringToHash("Velocity"); private static readonly int HitTrigger = Animator.StringToHash("Hit"); private static readonly int PlaneVector = Shader.PropertyToID("_Plane"); private static readonly int OffsetVector = Shader.PropertyToID("_Offset"); [Header("Glitch")] [SerializeField] private Vector2 _glitchPeriodStart = new Vector2(2f, 5f); [SerializeField] private Vector2 _glitchPeriodEnd = new Vector2(1f, 2f); [Header("Generic")] [SerializeField] private Animator _animator; [SerializeField] private Renderer _renderer; [SerializeField] private LagController _lagController; private Coroutine _playCoroutine; private float CurrentAnimationLength { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) AnimatorStateInfo currentAnimatorStateInfo = _animator.GetCurrentAnimatorStateInfo(0); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length; } } public int CurrentAnimation { get; private set; } public event Action<int> AnimationOver; private void Start() { SetGlitchPercent(0f); } public void SetGlitchPercent(float percent) { //IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) Vector2 lagPeriod = Vector2.Lerp(_glitchPeriodStart, _glitchPeriodEnd, percent); _lagController.SetLagPeriod(lagPeriod); } public void SetDeathGlitch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) _lagController.SetLagPeriod(Vector2.one * 0.35f); _lagController.SetLagLength(Vector2.one * float.MaxValue); _lagController.ResetLag(); } public void PlayAnimation(int animHash, float fadeTime = 0.15f) { _animator.CrossFade(animHash, fadeTime); SetCurrentAnimation(animHash); } public void PlayAnimationFixed(int animHash, float fadeTime = 0.15f) { _animator.CrossFadeInFixedTime(animHash, fadeTime); SetCurrentAnimation(animHash); } private void SetCurrentAnimation(int animHash) { CurrentAnimation = animHash; StartPlayCoroutine(); } public void SetPlane(Vector3 plane, Vector3 offset) { //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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) _renderer.material.SetVector(PlaneVector, Vector4.op_Implicit(plane)); _renderer.material.SetVector(OffsetVector, Vector4.op_Implicit(offset)); } public void PlayHit() { _animator.SetTrigger(HitTrigger); } private void StartPlayCoroutine() { if (_playCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_playCoroutine); this.AnimationOver?.Invoke(CurrentAnimation); } _playCoroutine = ((MonoBehaviour)(object)this).Delay(CurrentAnimationLength * 2f, delegate { this.AnimationOver?.Invoke(CurrentAnimation); }); } public void SetVelocity(float speed) { _animator.SetFloat(VelocityParam, speed); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LizaAnimator"; } } public class LizaRagdollDecals : MonoBehaviour { private LizaDecalService _decals; private Vector3 _lastSpawnPos; private void Awake() { _decals = ServiceLocator.ResolveSingle<LizaDecalService>(); } private void FixedUpdate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) RaycastHit val = default(RaycastHit); if (Vector3.Distance(((Component)this).transform.position, _lastSpawnPos) > 2f && Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 1f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { _decals.SpawnDecal(((RaycastHit)(ref val)).point, ((Component)this).transform.rotation); _lastSpawnPos = ((Component)this).transform.position; } } } public class LizaSfx : MonoBehaviour { [SerializeField] private PitchLag _pitchLag; [SerializeField] private AudioDistortionFilter _distortion; [SerializeField] private AudioSource _movementAudio; [SerializeField] private AudioSource _voice; [SerializeField] private AudioSource _lizaLag; [SerializeField] private List<AudioClip> _smallLaugh; [SerializeField] private List<AudioClip> _bigLaugh; [SerializeField] private List<AudioClip> _attackSounds; [SerializeField] private List<AudioClip> _attackLags; [SerializeField] private AudioClip _death; private List<FootstepSurface> _allSurfaces; private FootstepSurface _surface; private void Start() { FootstepSurface[] footstepSurfaces = StartOfRound.Instance.footstepSurfaces; List<FootstepSurface> list = new List<FootstepSurface>(footstepSurfaces.Length); list.AddRange(footstepSurfaces); _allSurfaces = list; } public void PlaySpawn() { Play(_voice, (IList<AudioClip>)_bigLaugh); } public void SmallLaugh() { Play(_voice, (IList<AudioClip>)_smallLaugh); } public void PlayDeath() { ((MonoBehaviour)(object)this).Tween(0f, 1f, _death.length - 0.1f, delegate(float p) { _distortion.distortionLevel = p; }); Play(_voice, _death); } public void PlayFootstepSound() { _movementAudio.pitch = Random.Range(0.93f, 1.07f); Play(_movementAudio, (IList<AudioClip>)GetSurface().clips); } public void PlayAttack() { Play(_voice, (IList<AudioClip>)_attackSounds); Play(_lizaLag, (IList<AudioClip>)_attackLags); } public void StopVoice() { _voice.Stop(); } private FootstepSurface GetSurface() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position + Vector3.up, -Vector3.up, ref val, 6f, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1)) { string tag = ((Component)((RaycastHit)(ref val)).collider).tag; foreach (FootstepSurface allSurface in _allSurfaces) { if (allSurface.surfaceTag == tag) { return allSurface; } } } return _allSurfaces[0]; } private static void Play(AudioSource source, AudioClip clip) { source.PlayOneShot(clip); WalkieTalkie.TransmitOneShotAudio(source, clip, 1f); } private static void Play(AudioSource source, IList<AudioClip> clips) { int index = Random.Range(0, clips.Count); AudioClip clip = clips[index]; Play(source, clip); } } public class LizaStateMachine : NetworkedStateMachine { [SerializeField] private LizaAnimator _animator; [SerializeField] private LizaAI _lizaAi; [SerializeField] private LizaVfx _vfx; [SerializeField] private LizaSfx _sfx; [SerializeField] private LagController _lag; [SerializeField] private NavMeshAgent _agent; private void Awake() { IState[] states = new IState[7] { new SpawnState(_animator, this, _lizaAi, _vfx, _sfx), new IdleState(_animator, this, _agent), new RunState(_animator, this, _agent, _sfx), new AttackState(_animator, this, _lizaAi, _vfx, _lag, _sfx), new DeathState(_animator, this, _lizaAi, _vfx, _sfx), new StunnedState(_animator, this, _lizaAi), new DespawnState(_animator, this, _lizaAi, _vfx) }; SetStates(states); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (((NetworkBehaviour)this).IsOwner) { SetState<SpawnState>(); } } protected override void __initializeVariables() { base.__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LizaStateMachine"; } } public class LizaVfx : MonoBehaviour { [SerializeField] private VisualEffect _spawnFx; [SerializeField] private VisualEffect _attackFx; [SerializeField] private VisualEffect _hitFx; [SerializeField] private VisualEffect _deathFxPrefab; [SerializeField] private SpawnDecal _spawnDecal; private void Awake() { StopAttackFx(); } public void SpawnDecal() { //IL_000c: 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) Object.Instantiate<SpawnDecal>(_spawnDecal, ((Component)this).transform.position, ((Component)this).transform.rotation); } public void SpawnFx() { } public void StartAttackFx() { _attackFx.Play(); } public void StopAttackFx() { _attackFx.Stop(); } public void HitFx() { _hitFx.Play(); } public void DeathFx() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0038: Unknown result type (might be due to invalid IL or missing references) VisualEffect fx = Object.Instantiate<VisualEffect>(_deathFxPrefab, ((Component)this).transform.position + ((Component)this).transform.up * 2f, ((Component)this).transform.rotation); ((MonoBehaviour)(object)this).Delay(2f, delegate { Object.Destroy((Object)(object)((Component)fx).gameObject); }); } } public class SpawnDecal : FadeableDecal { [SerializeField] private float _despawnDelay = 2f; private void Start() { FadeIn(); ((MonoBehaviour)(object)this).Delay(_despawnDelay, delegate { FadeOut(destroy: true); }); } } } namespace LizaPlugin.Components.Liza.States { public class AttackState : LizaStateBase, IStateBlocker { [CompilerGenerated] private LizaAI <lizaAi>P; [CompilerGenerated] private LizaVfx <vfx>P; [CompilerGenerated] private LagController <lag>P; [CompilerGenerated] private LizaSfx <sfx>P; private const float AttackLength = 1.25f; private const float AttackPeriod = 0.33f; private static readonly int AttackAnim = Animator.StringToHash("Attack"); private Coroutine _attackCoroutine; private IDisposable _movementToken; public bool IsBlocking { get; private set; } public AttackState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, LizaAI lizaAi, LizaVfx vfx, LagController lag, LizaSfx sfx) { <lizaAi>P = lizaAi; <vfx>P = vfx; <lag>P = lag; <sfx>P = sfx; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { _movementToken = <lizaAi>P.StopMovement(); _attackCoroutine = ((MonoBehaviour)<lizaAi>P).StartCoroutine(AttackCoroutine()); IsBlocking = true; LizaAnimator.PlayAnimation(AttackAnim); ((MonoBehaviour)(object)LizaAnimator).Delay(1.25f, Exit); <lag>P.ForceLag(); <vfx>P.StartAttackFx(); <sfx>P.PlayAttack(); } private IEnumerator AttackCoroutine() { WaitForSeconds delay = new WaitForSeconds(0.33f); float timeStart = Time.time; while (Time.time - timeStart <= 1.25f) { <lizaAi>P.PerformAttack(); yield return delay; } } private void Exit() { <lag>P.ResetLag(); <sfx>P.StopVoice(); <vfx>P.StopAttackFx(); ((MonoBehaviour)LizaAnimator).StopCoroutine(_attackCoroutine); IsBlocking = false; StateMachine.SetState<IdleState>(); _movementToken.Dispose(); _movementToken = null; } } public class DeathState : LizaStateBase, IStateBlocker { [CompilerGenerated] private LizaAI <lizaAi>P; [CompilerGenerated] private LizaVfx <vfx>P; [CompilerGenerated] private LizaSfx <sfx>P; private const float AnimationDuration = 1.75f; private static readonly int DeathAnim = Animator.StringToHash("Death"); public bool IsBlocking => true; public DeathState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, LizaAI lizaAi, LizaVfx vfx, LizaSfx sfx) { <lizaAi>P = lizaAi; <vfx>P = vfx; <sfx>P = sfx; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { <lizaAi>P.StopMovement(); <sfx>P.PlayDeath(); LizaAnimator.SetDeathGlitch(); LizaAnimator.PlayAnimationFixed(DeathAnim); ((MonoBehaviour)(object)LizaAnimator).Delay(1.75f, Die); } private void Die() { <lizaAi>P.Die(); <vfx>P.DeathFx(); } } public class DespawnState : LizaStateBase, IStateBlocker { [CompilerGenerated] private LizaAI <lizaAi>P; private static readonly int DespawnAnim = Animator.StringToHash("Despawn"); public bool IsBlocking => true; public DespawnState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, LizaAI lizaAi, LizaVfx vfx) { <lizaAi>P = lizaAi; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { <lizaAi>P.StopMovement(); LizaAnimator.PlayAnimationFixed(DespawnAnim); LizaAnimator.AnimationOver += OnAnimationOver; } private void OnAnimationOver(int _) { LizaAnimator.AnimationOver -= OnAnimationOver; <lizaAi>P.Die(); } } public class IdleState : LizaStateBase, IStateUpdateable { [CompilerGenerated] private NavMeshAgent <agent>P; private static readonly int IdleAnim = Animator.StringToHash("Idle"); public IdleState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, NavMeshAgent agent) { <agent>P = agent; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { LizaAnimator.PlayAnimationFixed(IdleAnim); } public void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)StateMachine).IsOwner) { Vector3 velocity = <agent>P.velocity; if (((Vector3)(ref velocity)).sqrMagnitude > 0f) { StateMachine.SetState<RunState>(); } } } } public abstract class LizaStateBase : IState { protected readonly LizaAnimator LizaAnimator; protected readonly LizaStateMachine StateMachine; protected LizaStateBase(LizaAnimator lizaAnimator, LizaStateMachine stateMachine) { LizaAnimator = lizaAnimator; StateMachine = stateMachine; base..ctor(); } public abstract void OnEnter(); } public class RunState : LizaStateBase, IStateUpdateable, IStateExit { [CompilerGenerated] private NavMeshAgent <agent>P; [CompilerGenerated] private LizaSfx <sfx>P; private static readonly int RunAnim = Animator.StringToHash("Run"); private Vector3 _lastPos; private Coroutine _laughCoroutine; private Transform Transform => ((Component)LizaAnimator).transform; public RunState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, NavMeshAgent agent, LizaSfx sfx) { <agent>P = agent; <sfx>P = sfx; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { SetupSchedule(); LizaAnimator.PlayAnimation(RunAnim); LizaAnimator.AnimationOver += OnAnimOver; } private void SetupSchedule() { ((MonoBehaviour)(object)LizaAnimator).Delay(0f, <sfx>P.PlayFootstepSound); ((MonoBehaviour)(object)LizaAnimator).Delay(0.21f, <sfx>P.PlayFootstepSound); if (_laughCoroutine != null) { ((MonoBehaviour)<sfx>P).StopCoroutine(_laughCoroutine); } _laughCoroutine = ((MonoBehaviour)(object)<sfx>P).Delay(Random.Range(0.5f, 2f), <sfx>P.SmallLaugh); } public void OnExit() { LizaAnimator.AnimationOver -= OnAnimOver; } public void Update() { UpdateWalkSpeed(); } private void UpdateWalkSpeed() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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 velocity = Vector3.Distance(Transform.position, _lastPos) / Time.deltaTime; LizaAnimator.SetVelocity(velocity); _lastPos = Transform.position; if (((NetworkBehaviour)StateMachine).IsOwner) { Vector3 velocity2 = <agent>P.velocity; if (Mathf.Approximately(((Vector3)(ref velocity2)).sqrMagnitude, 0f)) { StateMachine.SetState<IdleState>(); } } } private void OnAnimOver(int _) { SetupSchedule(); } } public class SpawnState : LizaStateBase, IStateExit, IStateBlocker { [CompilerGenerated] private LizaAI <lizaAi>P; [CompilerGenerated] private LizaVfx <vfx>P; [CompilerGenerated] private LizaSfx <sfx>P; private static readonly int SpawnAnim = Animator.StringToHash("Spawn"); private IDisposable _movementToken; private Transform Transform => ((Component)LizaAnimator).transform; private PlayerControllerB LocalPlayer => GameNetworkManager.Instance.localPlayerController; public bool IsBlocking { get; private set; } public SpawnState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, LizaAI lizaAi, LizaVfx vfx, LizaSfx sfx) { <lizaAi>P = lizaAi; <vfx>P = vfx; <sfx>P = sfx; IsBlocking = true; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { //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_0042: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) _movementToken = <lizaAi>P.StopMovement(); LizaAnimator.PlayAnimation(SpawnAnim, 0f); LizaAnimator.SetPlane(Transform.TransformDirection(-Transform.up), Transform.position); LizaAnimator.AnimationOver += LizaAnimatorOnAnimationOver; <sfx>P.PlaySpawn(); if (Vector3.Distance(((Component)LocalPlayer).transform.position, Transform.position) <= 5f) { LocalPlayer.JumpToFearLevel(1f, true); } SetupSchedule(); } private void SetupSchedule() { ((MonoBehaviour)(object)LizaAnimator).Delay(0f, <vfx>P.SpawnDecal); ((MonoBehaviour)(object)LizaAnimator).Delay(0.18f, <vfx>P.SpawnFx); ((MonoBehaviour)(object)LizaAnimator).Delay(1.15f, <vfx>P.SpawnFx); ((MonoBehaviour)(object)LizaAnimator).Delay(2.09f, <vfx>P.SpawnFx); } public void OnExit() { //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) LizaAnimator.SetPlane(Vector3.zero, Vector3.zero); ((Behaviour)((EnemyAI)<lizaAi>P).agent).enabled = true; LizaAnimator.AnimationOver -= LizaAnimatorOnAnimationOver; _movementToken.Dispose(); _movementToken = null; } private void LizaAnimatorOnAnimationOver(int animHash) { LizaAnimator.AnimationOver -= LizaAnimatorOnAnimationOver; IsBlocking = false; StateMachine.SetState<IdleState>(); } } public class StunnedState : LizaStateBase, IStateBlocker, IStateExit { [CompilerGenerated] private LizaAI <lizaAi>P; private static readonly int StunAnim = Animator.StringToHash("Stun"); private static readonly int StunWearOffAnim = Animator.StringToHash("StunWearOff"); private IDisposable _movementToken; public bool IsBlocking { get; private set; } public StunnedState(LizaAnimator lizaAnimator, LizaStateMachine stateMachine, LizaAI lizaAi) { <lizaAi>P = lizaAi; base..ctor(lizaAnimator, stateMachine); } public override void OnEnter() { _movementToken = <lizaAi>P.StopMovement(); IsBlocking = true; LizaAnimator.PlayAnimation(StunAnim); ((MonoBehaviour)<lizaAi>P).StartCoroutine(WaitForStunWearOff()); } private IEnumerator WaitForStunWearOff() { float startTime = Time.time; yield return (object)new WaitWhile((Func<bool>)(() => ((EnemyAI)<lizaAi>P).stunnedIndefinitely > 0 || Time.time - startTime < ((EnemyAI)<lizaAi>P).stunNormalizedTimer)); StunWearOff(); } private void StunWearOff() { LizaAnimator.PlayAnimation(StunWearOffAnim); LizaAnimator.AnimationOver += OnAnimOver; } private void OnAnimOver(int animHash) { LizaAnimator.AnimationOver -= OnAnimOver; IsBlocking = false; StateMachine.SetState<IdleState>(); } public void OnExit() { _movementToken.Dispose(); _movementToken = null; LizaAnimator.AnimationOver -= OnAnimOver; } } } namespace LizaPlugin.Components.Hat { public class HatAnimator : MonoBehaviour { private static readonly int IsSmashed = Animator.StringToHash("IsSmashed"); [SerializeField] private Animator _animator; public void Smash() { _animator.SetBool(IsSmashed, true); } public void UnSmash() { _animator.SetBool(IsSmashed, false); } } public class HatItem : GrabbableObject { private readonly NetworkVariable<int> _scrapValue = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<bool> _isFromThisMoon = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [SerializeField] private int _constCost = 190; [SerializeField] private float _spawnDelay = 5f; [SerializeField] private HatSfx _sfx; [SerializeField] private GameObject _despawnSfx; private LizaSpawnService _lizaSpawnService; public float SpawnDelay => _spawnDelay; public bool IsFromThisMoon { get { return _isFromThisMoon.Value; } set { _isFromThisMoon.Value = value; } } private void Awake() { _lizaSpawnService = ServiceLocator.ResolveSingle<LizaSpawnService>(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (base.scrapValue <= 0 && ((NetworkBehaviour)this).IsOwner) { _scrapValue.Value = _constCost; } NetworkVariable<int> scrapValue = _scrapValue; scrapValue.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)scrapValue.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnScrapValueChanged)); int value = _scrapValue.Value; if (value > 0) { ((GrabbableObject)this).SetScrapValue(value); } } public override void OnDestroy() { //IL_0012: 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) ((NetworkBehaviour)this).OnDestroy(); GameObject val = Object.Instantiate<GameObject>(_despawnSfx, ((Component)this).transform.position, ((Component)this).transform.rotation); Object.Destroy((Object)(object)val, 1f); } public void DespawnItem() { ((MonoBehaviour)this).StartCoroutine(Despawn()); IEnumerator Despawn() { PlayerControllerB componentInParent = ((Component)this).GetComponentInParent<PlayerControllerB>(); if (Object.op_Implicit((Object)(object)componentInParent)) { componentInParent.SetObjectAsNoLongerHeld(false, false, Vector3.zeroVector, (GrabbableObject)(object)this, -1); ((GrabbableObject)this).DiscardItemOnClient(); yield return (object)new WaitForEndOfFrame(); } ((Component)this).GetComponent<NetworkObject>().Despawn(true); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); _sfx.PickUp(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); _sfx.PickUp(); } public override void PlayDropSFX() { _sfx.Drop(); } private void OnScrapValueChanged(int _, int value) { ((GrabbableObject)this).SetScrapValue(value); } public override void GrabItem() { RequestLizaSpawn(); ((GrabbableObject)this).GrabItem(); } private void RequestLizaSpawn() { if (((NetworkBehaviour)this).IsServer) { RequestLizaInternal(); } else { RequestLizaServerRpc(); } } [ServerRpc] private void RequestLizaServerRpc() { //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(2226658802u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2226658802u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RequestLizaInternal(); } } private void RequestLizaInternal() { if (IsFromThisMoon && Object.op_Implicit((Object)(object)base.playerHeldBy)) { _lizaSpawnService.RequestLiza(this); } } protected override void __initializeVariables() { if (_scrapValue == null) { throw new Exception("HatItem._scrapValue cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_scrapValue).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_scrapValue, "_scrapValue"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_scrapValue); if (_isFromThisMoon == null) { throw new Exception("HatItem._isFromThisMoon cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_isFromThisMoon).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_isFromThisMoon, "_isFromThisMoon"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_isFromThisMoon); ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_HatItem() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2226658802u, new RpcReceiveHandler(__rpc_handler_2226658802)); } private static void __rpc_handler_2226658802(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; ((HatItem)(object)target).RequestLizaServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "HatItem"; } } public class HatSfx : MonoBehaviour { [SerializeField] private AudioSource _audioSource; [SerializeField] private List<AudioClip> _pickUpSounds; [SerializeField] private List<AudioClip> _dropSounds; public void PickUp() { PlaySound(_pickUpSounds); } public void Drop() { PlaySound(_dropSounds); } private void PlaySound(List<AudioClip> clips) { AudioClip val = clips[Random.Range(0, clips.Count)]; _audioSource.PlayOneShot(val); WalkieTalkie.TransmitOneShotAudio(_audioSource, val, 1f); } } } namespace LizaPlugin.AssetManagement { public static class AssetPaths { public const string BundleName = "liza_assets_all.bundle"; public const string HatItem = "Assets/__MOD/Hat/Hat.asset"; public const string LizaRagDoll = "Assets/__MOD/Ragdoll/Ragdoll.prefab"; public const string LagDecal = "Assets/__MOD/LagDecal/LagDecal.prefab"; private const string AssetRootPath = "Assets/__MOD"; public static string LizaEnemy => "Assets/__MOD/LizaEnemy/LizaEnemyType.asset"; public static string LizaTerminalKeyword => "Assets/__MOD/LizaEnemy/Terminal/LizaKeyword.asset"; public static string LizaNode => "Assets/__MOD/LizaEnemy/Terminal/LizaNode.asset"; } public interface IAssetProvider : IService { EnemyType LizaEnemyType { get; } Item HatItem { get; } GameObject LizaRagDoll { get; } GameObject LagDecal { get; } TerminalKeyword LizaTerminalKeyword { get; } TerminalNode LizaTerminalNode { get; } } public class RuntimeAssetProvider : IAssetProvider, IService { private readonly AssetBundle _assetBundle; public EnemyType LizaEnemyType => LoadAssetBundleAsset<EnemyType>(AssetPaths.LizaEnemy); public Item HatItem => LoadAssetBundleAsset<Item>("Assets/__MOD/Hat/Hat.asset"); public GameObject LizaRagDoll => LoadAssetBundleAsset<GameObject>("Assets/__MOD/Ragdoll/Ragdoll.prefab"); public GameObject LagDecal => LoadAssetBundleAsset<GameObject>("Assets/__MOD/LagDecal/LagDecal.prefab"); public TerminalKeyword LizaTerminalKeyword => LoadAssetBundleAsset<TerminalKeyword>(AssetPaths.LizaTerminalKeyword); public TerminalNode LizaTerminalNode => LoadAssetBundleAsset<TerminalNode>(AssetPaths.LizaNode); public RuntimeAssetProvider() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _assetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "liza_assets_all.bundle")); if (_assetBundle == null) { throw new FileLoadException("Failed to load assets"); } } private T LoadAssetBundleAsset<T>(string path) where T : Object { T val = _assetBundle.LoadAsset<T>(path); if (val == null) { if (_assetBundle.GetAllAssetNames().Contains(path)) { throw new InvalidCastException(path + " is not " + typeof(T).Name); } throw new NullReferenceException("Asset with path does not exist: " + path); } return val; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace cunningfox146.liza.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }