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 Evil Seal MF v1.0.0
BepInEx/plugins/EvilSealMF/EvilSealMF.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 EvilSealMF.Configuration; using EvilSealMF.NetcodePatcher; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; [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("EvilSealMF")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EvilSealMF")] [assembly: AssemblyTitle("EvilSealMF")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.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] [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] [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 EvilSealMF { public enum SealAct : byte { Roam, Follow, StarePlayer, StareWall, HeadTilt, Twitch, Spin, ItalianMeltdown, SpanishBreakdown, FakeCharge, FakeSqueak, GoToCorpse, Sniff, Taste, Celebrate, Pancake, PetHappy, PetExcited, PetFreeze, Talk, PrankChase, Chase, Scream, Transform, Dead } public class EvilSealAI : EnemyAI { public const float ModelScale = 1.5f; public const float MasterVolume = 0.5f; public const byte TalkSilence = 100; public const byte TalkHonk = 101; public const byte TalkWeird = 102; public InteractTrigger petTrigger; public InteractTrigger talkTrigger; public ScanNodeProperties scanNode; private int syncedMadness; private int syncedDamage = 30; private float timeSinceHittingLocalPlayer; private float nextEvilVoice; private int shownStage = 1; private SealSpeech? speech; private static readonly List<EvilSealAI> allSeals = new List<EvilSealAI>(); private readonly AISearchRoutine roamSearch = new AISearchRoutine(); private readonly HashSet<int> tastedBodies = new HashSet<int>(); private float madness; private float nextDecision; private float nextSpike; private float interactReady; private float chaseBreak; private float actTimeout; private int hostStage = 1; private DeadBodyInfo? corpse; private static Sprite? handIcon; public SealAct Act { get; private set; } public float ActStart { get; private set; } public float ActDuration { get; private set; } public int ActVariant { get; private set; } public PlayerControllerB? ActPlayer { get; private set; } public float Madness01 => (float)syncedMadness / 100f; public int Stage => StageOf(syncedMadness); private static PluginConfig Cfg => Plugin.BoundConfig; private float RoamSpeed => Cfg.MoveSpeed.Value * ((hostStage == 1) ? 1f : ((hostStage == 2) ? 1.1f : ((hostStage == 3) ? 1.4f : 1.6f))); public static int StageOf(float m) { if (!(m < 25f)) { if (!(m < 50f)) { if (!(m < 75f)) { return 4; } return 3; } return 2; } return 1; } internal static void RefreshSpawnCaps() { int num = 0; int num2 = 0; foreach (EvilSealAI allSeal in allSeals) { if (!((Object)(object)allSeal == (Object)null)) { if ((Object)(object)((EnemyAI)allSeal).enemyType == (Object)(object)Plugin.OutdoorType) { num2++; } else { num++; } } } int value = Cfg.MaxSeals.Value; bool flag = Cfg.IndoorSpawnWeight.Value > 0; bool flag2 = Cfg.OutdoorSpawnWeight.Value > 0; Plugin.IndoorType.MaxCount = (flag ? Mathf.Max(0, value - num2) : 0); Plugin.OutdoorType.MaxCount = (flag2 ? Mathf.Max(0, value - num) : 0); } public override void Start() { ((EnemyAI)this).Start(); allSeals.Add(this); RefreshSpawnCaps(); PickNavigationNodes(); MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val in componentsInChildren) { int num = MaterialFor(((Object)((Component)val).gameObject).name); if (num >= 0) { Material material = SealAssets.GetMaterial(num); if ((Object)(object)material != (Object)null) { ((Renderer)val).sharedMaterial = material; } } } ((Component)this).GetComponentInChildren<SealVisual>(true).Init(this); if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.speakerAudioSource != (Object)null) { AudioMixerGroup outputAudioMixerGroup = StartOfRound.Instance.speakerAudioSource.outputAudioMixerGroup; base.creatureVoice.outputAudioMixerGroup = outputAudioMixerGroup; base.creatureSFX.outputAudioMixerGroup = outputAudioMixerGroup; } base.creatureVoice.volume = 0.5f * Cfg.SoundVolume.Value; base.creatureSFX.volume = 0.5f * Cfg.SoundVolume.Value; if ((Object)(object)Plugin.InfoNode != (Object)null) { scanNode.creatureScanID = Plugin.InfoNode.creatureFileID; } SetupTrigger(petTrigger, isPet: true); SetupTrigger(talkTrigger, isPet: false); if (Cfg.ShowSpeechText.Value) { speech = SealSpeech.TryCreate(((Component)this).transform); } ActStart = Time.time; if (((NetworkBehaviour)this).IsServer) { madness = Mathf.Clamp(Cfg.StartingMadness.Value, 0f, 100f); hostStage = StageOf(madness); SyncMadnessClientRpc((int)madness, Cfg.AttackDamage.Value); base.enemyHP = Cfg.Health.Value; nextDecision = Time.time + Random.Range(3f, 6f); nextSpike = Time.time + Random.Range(30f, 60f); roamSearch.loopSearch = true; roamSearch.randomized = true; roamSearch.searchWidth = 70f; SetAct(SealAct.Roam, 0f); } } private static int MaterialFor(string part) { switch (part) { case "Head": case "Body": case "FlipperL": case "FlipperR": case "TailFlippers": return 0; case "EyeL": case "EyeR": return 1; case "Whiskers": case "Highlights": return 2; case "Nose": return 3; case "Mouth": return 5; case "Tongue": return 6; default: return -1; } } private void PickNavigationNodes() { GameObject[] array = (((Object)(object)RoundManager.Instance != (Object)null) ? RoundManager.Instance.insideAINodes : null); GameObject[] array2 = (((Object)(object)RoundManager.Instance != (Object)null) ? RoundManager.Instance.outsideAINodes : null); if (array == null || array.Length == 0) { array = GameObject.FindGameObjectsWithTag("AINode"); } if (array2 == null || array2.Length == 0) { array2 = GameObject.FindGameObjectsWithTag("OutsideAINode"); } float num = Nearest(array); float num2 = Nearest(array2); bool flag = base.enemyType.isOutsideEnemy; if (num < float.MaxValue || num2 < float.MaxValue) { flag = num2 < num; } base.isOutside = flag; GameObject[] array3 = (flag ? array2 : array); if (array3 != null && array3.Length != 0) { base.allAINodes = array3; } } private float Nearest(GameObject[]? nodes) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; if (nodes == null) { return num; } foreach (GameObject val in nodes) { if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; } } } return num; } private void SetupTrigger(InteractTrigger t, bool isPet) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown if ((Object)(object)handIcon == (Object)null) { InteractTrigger[] array = Object.FindObjectsOfType<InteractTrigger>(); foreach (InteractTrigger val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.hoverIcon != (Object)null) { handIcon = val.hoverIcon; break; } } } if ((Object)(object)t.hoverIcon == (Object)null && (Object)(object)handIcon != (Object)null) { t.hoverIcon = handIcon; } if (t.onInteract == null) { t.onInteract = new InteractEvent(); } if (t.onInteractEarly == null) { t.onInteractEarly = new InteractEvent(); } if (t.onStopInteract == null) { t.onStopInteract = new InteractEvent(); } if (t.holdingInteractEvent == null) { t.holdingInteractEvent = new InteractEventFloat(); } if (t.onCancelAnimation == null) { t.onCancelAnimation = new InteractEvent(); } if (isPet) { ((UnityEvent<PlayerControllerB>)(object)t.onInteract).AddListener((UnityAction<PlayerControllerB>)OnLocalPet); } else { ((UnityEvent<PlayerControllerB>)(object)t.onInteract).AddListener((UnityAction<PlayerControllerB>)OnLocalTalk); } } public override void OnDestroy() { allSeals.Remove(this); if ((Object)(object)Plugin.IndoorType != (Object)null) { RefreshSpawnCaps(); } ((EnemyAI)this).OnDestroy(); } public override void Update() { ((EnemyAI)this).Update(); timeSinceHittingLocalPlayer += Time.deltaTime; if (!base.isEnemyDead) { int stage = Stage; if (stage != shownStage) { shownStage = stage; petTrigger.hoverTip = ((stage >= 4) ? "DO NOT pet the seal : [LMB]" : "Pet the seal : [LMB]"); talkTrigger.hoverTip = ((stage >= 4) ? "Beg for mercy : [LMB]" : "Talk to the MF : [LMB]"); } if (Act == SealAct.Chase && Stage >= 4 && Time.time >= nextEvilVoice) { PlayEvilVoice(); } if (((NetworkBehaviour)this).IsServer && base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } } } public override void DoAIInterval() { //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (!((NetworkBehaviour)this).IsServer || base.isEnemyDead || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayersDead || base.stunNormalizedTimer > 0f) { return; } TickMadness(base.AIIntervalTime); if (base.isEnemyDead) { return; } float num = Time.time - ActStart; bool flag = ActDuration > 0f && num >= ActDuration; SealAct act = Act; switch (act) { case SealAct.Follow: if (act != SealAct.Follow) { goto default; } base.agent.speed = RoamSpeed * 1.25f; if (flag || !Targetable(ActPlayer) || Dist(ActPlayer) > 20f) { BackToRoam(); } break; case SealAct.Roam: base.agent.speed = RoamSpeed; if ((hostStage < 4 || !TryStartChase()) && Time.time >= nextDecision) { Decide(); } break; case SealAct.FakeCharge: base.agent.speed = Cfg.ChaseSpeed.Value * 1.1f; if (!Targetable(ActPlayer)) { BackToRoam(); } else if (Dist(ActPlayer) < 3.4f || flag) { SetAct(SealAct.FakeSqueak, 1.8f, ActPlayer); } break; case SealAct.PrankChase: base.agent.speed = Cfg.ChaseSpeed.Value * 0.8f; if (!Targetable(ActPlayer)) { BackToRoam(); } else if (Dist(ActPlayer) < 2.2f || flag) { SetAct(SealAct.FakeSqueak, 1.4f, ActPlayer, 1); } break; case SealAct.Chase: base.agent.speed = Cfg.ChaseSpeed.Value; if (!((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true) || (Object)(object)base.targetPlayer == (Object)null || Dist(base.targetPlayer) > 50f) { BackToRoam(); } else if ((Object)(object)base.targetPlayer != (Object)(object)ActPlayer) { SetAct(SealAct.Chase, 0f, base.targetPlayer); } else if (Time.time >= chaseBreak) { chaseBreak = Time.time + Random.Range(7f, 14f); if (Random.value < 0.5f) { SetAct(SealAct.Scream, 1.4f, base.targetPlayer, Random.Range(0, 2)); } else { SetAct(SealAct.StarePlayer, 1.1f, base.targetPlayer); } } break; case SealAct.GoToCorpse: base.agent.speed = RoamSpeed * 1.3f; if ((Object)(object)corpse == (Object)null || corpse.deactivated || Time.time > actTimeout) { corpse = null; BackToRoam(); } else if (Vector3.Distance(((Component)this).transform.position, ((Component)corpse).transform.position) < 2.4f) { SetAct(SealAct.Sniff, 1.8f); } else { ((EnemyAI)this).SetDestinationToPosition(((Component)corpse).transform.position, false); } break; case SealAct.Sniff: if (!flag) { break; } if ((Object)(object)corpse != (Object)null && !corpse.deactivated && Random.value < ((hostStage >= 3) ? 0.85f : 0.35f)) { SetAct(SealAct.Taste, 2.2f); break; } if ((Object)(object)corpse != (Object)null) { tastedBodies.Add(((Object)corpse).GetInstanceID()); } corpse = null; AddMadness(3f); BackToRoam(); break; case SealAct.Taste: if (flag) { if ((Object)(object)corpse != (Object)null) { tastedBodies.Add(((Object)corpse).GetInstanceID()); } corpse = null; AddMadness(12f); if (!base.isEnemyDead && Act == SealAct.Taste) { SetAct(SealAct.Celebrate, 1.6f); } } break; default: if (flag) { BackToRoam(); } break; } } private void TickMadness(float dt) { float num = 0.18f * dt; if (Time.time >= nextSpike) { nextSpike = Time.time + Random.Range(30f, 60f); if (Random.value < 0.4f) { num += Random.Range(4f, 9f); if (Act == SealAct.Roam && hostStage < 4) { SetAct(SealAct.Twitch, 1.2f, null, Random.Range(0, 2)); } } } AddMadness(num); } private void AddMadness(float amount) { madness = Mathf.Clamp(madness + amount * Cfg.MadnessSpeed.Value, 0f, 100f); if ((int)madness != syncedMadness) { SyncMadnessClientRpc((int)madness, Cfg.AttackDamage.Value); } int num = StageOf(madness); if (num > hostStage) { hostStage = num; chaseBreak = Time.time + Random.Range(7f, 14f); SetAct(SealAct.Transform, 1.5f, null, num); } } private void BackToRoam() { nextDecision = Time.time + Random.Range(5f, 11f) / Mathf.Max(0.1f, Cfg.EventFrequency.Value); SetAct(SealAct.Roam, 0f); } private bool TryStartChase() { if (!((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true) || (Object)(object)base.targetPlayer == (Object)null || Dist(base.targetPlayer) > 45f) { return false; } SetAct(SealAct.Chase, 0f, base.targetPlayer); return true; } private void Decide() { PlayerControllerB val = NearestPlayer(16f); DeadBodyInfo val2 = FindCorpse((hostStage >= 3) ? 40f : 14f); int num = hostStage; List<KeyValuePair<SealAct, float>> w = new List<KeyValuePair<SealAct, float>>(); Add(SealAct.Roam, num switch { 2 => 3f, 1 => 5f, _ => 2f, }); Add(SealAct.HeadTilt, num switch { 2 => 2f, 1 => 3f, _ => 0.5f, }); Add(SealAct.StareWall, (num == 1) ? 1f : 2f); Add(SealAct.Pancake, (num == 1) ? 0.6f : 1.2f); if ((Object)(object)val != (Object)null) { Add(SealAct.Follow, num switch { 2 => 2f, 1 => 3f, _ => 0f, }); Add(SealAct.StarePlayer, (num == 1) ? 1f : 3f); } if (num >= 2) { Add(SealAct.Twitch, (num == 2) ? 2.5f : 3f); Add(SealAct.Spin, 2.2f); Add(SealAct.Talk, 2.2f); Add(SealAct.ItalianMeltdown, (num == 2) ? 1f : 1.6f); Add(SealAct.SpanishBreakdown, (num == 2) ? 1f : 1.6f); } if (num >= 3) { Add(SealAct.Scream, 2.5f); if ((Object)(object)val != (Object)null && num == 3) { Add(SealAct.FakeCharge, 2.5f); Add(SealAct.PrankChase, 2.5f); } } if ((Object)(object)val2 != (Object)null) { Add(SealAct.GoToCorpse, num switch { 2 => 3f, 1 => 2f, _ => 6f, }); } float num2 = 0f; foreach (KeyValuePair<SealAct, float> item in w) { num2 += item.Value; } float num3 = Random.value * num2; SealAct sealAct = SealAct.Roam; foreach (KeyValuePair<SealAct, float> item2 in w) { num3 -= item2.Value; if (num3 <= 0f) { sealAct = item2.Key; break; } } switch (sealAct) { case SealAct.Roam: nextDecision = Time.time + Random.Range(5f, 11f) / Mathf.Max(0.1f, Cfg.EventFrequency.Value); if (Random.value < 0.7f) { PlaySoundClientRpc((byte)((num >= 3) ? Random.Range(4, 6) : Random.Range(0, 4)), Random.Range(0.9f, 1.15f)); } break; case SealAct.Follow: SetAct(sealAct, Random.Range(6f, 12f), val); break; case SealAct.StarePlayer: SetAct(sealAct, Random.Range(2.5f, 5f) + ((num >= 3) ? 2f : 0f), val); break; case SealAct.StareWall: SetAct(sealAct, Random.Range(2.5f, 5f)); break; case SealAct.HeadTilt: SetAct(sealAct, 1.6f, val, Random.Range(0, 6)); break; case SealAct.Twitch: SetAct(sealAct, Random.Range(0.8f, 1.6f), null, Random.Range(0, 2)); break; case SealAct.Spin: SetAct(sealAct, 1.4f, null, Random.Range(0, 2)); break; case SealAct.Talk: SetAct(sealAct, 1.6f, val, RandomReply(), (num >= 3) ? Random.Range(0.6f, 1.4f) : Random.Range(0.95f, 1.1f)); break; case SealAct.ItalianMeltdown: SetAct(sealAct, 2.4f, null, 0, (num >= 3) ? 0.8f : 1f); break; case SealAct.SpanishBreakdown: SetAct(sealAct, 3.2f, null, 0, (num >= 3) ? 0.8f : 1f); break; case SealAct.Pancake: SetAct(sealAct, 1.8f); break; case SealAct.Scream: SetAct(sealAct, 1.5f, val, Random.Range(0, 2)); break; case SealAct.FakeCharge: SetAct(sealAct, 6f, val); break; case SealAct.PrankChase: SetAct(sealAct, Random.Range(4f, 6f), val); break; case SealAct.GoToCorpse: corpse = val2; actTimeout = Time.time + 20f; SetAct(sealAct, 0f); break; case SealAct.FakeSqueak: case SealAct.Sniff: case SealAct.Taste: case SealAct.Celebrate: case SealAct.PetHappy: case SealAct.PetExcited: case SealAct.PetFreeze: case SealAct.Chase: break; } void Add(SealAct a, float weight) { if (weight > 0f) { w.Add(new KeyValuePair<SealAct, float>(a, weight)); } } } private byte RandomReply() { float value = Random.value; if (value < 0.18f) { return 100; } if (value < 0.3f) { return 101; } if (value < 0.4f && hostStage >= 2) { return 102; } return (byte)Random.Range(0, SealAssets.Phrases.Length); } private float Dist(PlayerControllerB p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position); } private bool Targetable(PlayerControllerB? p) { if ((Object)(object)p != (Object)null) { return ((EnemyAI)this).PlayerIsTargetable(p, false, false, true); } return false; } private PlayerControllerB? NearestPlayer(float range) { PlayerControllerB result = null; float num = range; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (Targetable(val)) { float num2 = Dist(val); if (num2 < num) { num = num2; result = val; } } } return result; } private DeadBodyInfo? FindCorpse(float range) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) DeadBodyInfo result = null; float num = range; NavMeshPath val = new NavMeshPath(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < allPlayerScripts.Length; i++) { DeadBodyInfo deadBody = allPlayerScripts[i].deadBody; if (!((Object)(object)deadBody == (Object)null) && !deadBody.deactivated && ((Component)deadBody).gameObject.activeInHierarchy && !tastedBodies.Contains(((Object)deadBody).GetInstanceID())) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)deadBody).transform.position); if (!(num2 >= num) && NavMesh.SamplePosition(((Component)deadBody).transform.position, ref val2, 3f, -1) && base.agent.isOnNavMesh && base.agent.CalculatePath(((NavMeshHit)(ref val2)).position, val) && (int)val.status == 0) { num = num2; result = deadBody; } } } return result; } private void SetAct(SealAct act, float duration, PlayerControllerB? player = null, int variant = 0, float pitch = 1f) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead) { return; } bool num = act == SealAct.Roam || act == SealAct.Follow || act == SealAct.FakeCharge || act == SealAct.PrankChase || act == SealAct.Chase || act == SealAct.GoToCorpse; if (act != SealAct.Roam && base.currentSearch != null && base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } base.agent.stoppingDistance = ((act == SealAct.Follow) ? 2.6f : 0f); if (!num) { base.movingTowardsTargetPlayer = false; base.moveTowardsDestination = false; base.targetPlayer = null; base.destination = ((Component)this).transform.position; if (base.agent.isOnNavMesh) { base.agent.ResetPath(); } base.agent.velocity = Vector3.zero; base.agent.speed = 0f; if ((Object)(object)player != (Object)null) { Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { ((Component)this).transform.rotation = Quaternion.LookRotation(val); } } } else { switch (act) { case SealAct.Roam: base.movingTowardsTargetPlayer = false; base.targetPlayer = null; if (base.currentSearch == null || !base.currentSearch.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, roamSearch); } break; case SealAct.GoToCorpse: base.movingTowardsTargetPlayer = false; base.targetPlayer = null; if ((Object)(object)corpse != (Object)null) { ((EnemyAI)this).SetDestinationToPosition(((Component)corpse).transform.position, false); } break; default: if ((Object)(object)player != (Object)null) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(player); base.moveTowardsDestination = true; } break; } } ApplyAct(act, duration, player, variant, pitch); SetActClientRpc((byte)act, duration, ((Object)(object)player != (Object)null) ? ((int)player.playerClientId) : (-1), (byte)variant, pitch); } [ClientRpc] private void SetActClientRpc(byte act, float duration, int playerId, byte variant, float pitch) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0098: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2656513498u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref act, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref duration, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, playerId); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref variant, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2656513498u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { PlayerControllerB player = null; if (playerId >= 0 && playerId < StartOfRound.Instance.allPlayerScripts.Length) { player = StartOfRound.Instance.allPlayerScripts[playerId]; } ApplyAct((SealAct)act, duration, player, variant, pitch); } } [ClientRpc] private void SyncMadnessClientRpc(int value, int damage) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(639390738u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, value); BytePacker.WriteValueBitPacked(val, damage); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 639390738u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; bool num = Stage >= 4; syncedMadness = Mathf.Clamp(value, 0, 100); syncedDamage = damage; if (num && Stage < 4) { base.creatureVoice.Stop(); nextEvilVoice = 0f; } } } [ClientRpc] private void PlaySoundClientRpc(byte sound, float pitch) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3533277252u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(ref sound, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3533277252u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!base.isEnemyDead) { string[] array = new string[6] { "squeak1", "squeak2", "squeak3", "honk1", "weird1", "weird2" }; PlayVoice(SealAssets.Clip(array[Mathf.Min((int)sound, array.Length - 1)]), 0.7f, pitch); } } } [ServerRpc(RequireOwnership = false)] private void PetServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(24095032u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 24095032u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!CanInteract(playerId, out PlayerControllerB p)) { return; } if (hostStage >= 4) { SetAct(SealAct.Scream, 1f, p); return; } AddMadness(1f); if (Act != SealAct.Transform && !base.isEnemyDead) { float value = Random.value; if (value < 0.55f) { SetAct(SealAct.PetHappy, 1.6f, p, Random.Range(0, 3)); } else if (value < 0.75f) { SetAct(SealAct.PetExcited, 2.2f, p); AddMadness(3f); } else if (value < 0.9f) { SetAct(SealAct.PetFreeze, Random.Range(2.5f, 4f), p); } else { SetAct(SealAct.Twitch, 1.4f, p, 1); AddMadness(8f); } } } [ServerRpc(RequireOwnership = false)] private void TalkServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(310578478u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 310578478u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!CanInteract(playerId, out PlayerControllerB p, hostStage >= 4)) { return; } if (hostStage >= 4) { CalmDown(p); return; } AddMadness(1.5f); if (Act != SealAct.Transform && !base.isEnemyDead) { float pitch = ((hostStage >= 3) ? Random.Range(0.6f, 1.4f) : ((hostStage == 2) ? Random.Range(0.85f, 1.2f) : Random.Range(0.97f, 1.08f))); SetAct(SealAct.Talk, 1.7f, p, RandomReply(), pitch); } } private void CalmDown(PlayerControllerB? p) { madness = 0f; hostStage = 1; nextSpike = Time.time + Random.Range(30f, 60f); SyncMadnessClientRpc(0, Cfg.AttackDamage.Value); SetAct(SealAct.PetHappy, 1.8f, p, Random.Range(0, 3)); } private bool CanInteract(int playerId, out PlayerControllerB? p, bool evenWhileHunting = false) { p = null; if (base.isEnemyDead || Time.time < interactReady || base.stunNormalizedTimer > 0f) { return false; } if (playerId < 0 || playerId >= StartOfRound.Instance.allPlayerScripts.Length) { return false; } p = StartOfRound.Instance.allPlayerScripts[playerId]; if ((Object)(object)p == (Object)null || p.isPlayerDead || !p.isPlayerControlled || Dist(p) > 8f) { return false; } if (!evenWhileHunting && (Act == SealAct.Chase || Act == SealAct.FakeCharge || Act == SealAct.PrankChase || Act == SealAct.Taste || Act == SealAct.Transform)) { return false; } interactReady = Time.time + 1.2f; return true; } private void OnLocalPet(PlayerControllerB player) { if (!((Object)(object)player == (Object)null) && !base.isEnemyDead && !((Object)(object)player != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { PetServerRpc((int)player.playerClientId); } } private void OnLocalTalk(PlayerControllerB player) { if (!((Object)(object)player == (Object)null) && !base.isEnemyDead && !((Object)(object)player != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { TalkServerRpc((int)player.playerClientId); } } private void ApplyAct(SealAct act, float duration, PlayerControllerB? player, int variant, float pitch) { if (base.isEnemyDead && act != SealAct.Dead) { return; } Act = act; ActStart = Time.time; ActDuration = duration; ActPlayer = player; ActVariant = variant; int stage = Stage; switch (act) { case SealAct.Follow: PlayVoice(SealAssets.Clip("squeak1"), 0.7f, 1f); break; case SealAct.StarePlayer: if (stage >= 3) { PlayVoice(SealAssets.Clip("weird1"), 0.35f, 0.7f); } break; case SealAct.HeadTilt: PlayVoice(SealAssets.Clip("squeak" + (variant % 3 + 1)), 0.7f, 1f); break; case SealAct.Twitch: PlayVoice(SealAssets.Clip((stage < 2) ? "tinysqueak" : ((variant % 2 == 0) ? "weird1" : "weird2")), 0.7f, 1f); break; case SealAct.Spin: PlayVoice(SealAssets.Clip("honk1"), 0.8f, 1.1f); break; case SealAct.ItalianMeltdown: PlayVoice(SealAssets.Clip("phrase0"), 1f, pitch); Say(SealAssets.Phrases[0]); if (stage >= 3) { PlaySfx(SealAssets.Clip("scream1"), 0.45f); } break; case SealAct.SpanishBreakdown: PlayVoice(SealAssets.Clip("phrase1"), 1f, pitch); Say(SealAssets.Phrases[1]); break; case SealAct.FakeCharge: PlayVoice(SealAssets.Clip("scream1"), 0.9f, 1.15f); break; case SealAct.FakeSqueak: PlayVoice(SealAssets.Clip((variant == 0) ? "tinysqueak" : "honk2"), (variant == 0) ? 0.6f : 0.9f, 1f); break; case SealAct.PrankChase: PlayVoice(SealAssets.Clip("honk2"), 0.9f, 1.2f); break; case SealAct.Sniff: PlaySfx(SealAssets.Clip("sniff"), 0.8f); break; case SealAct.Taste: PlaySfx(SealAssets.Clip("lick"), 0.9f); break; case SealAct.Celebrate: PlayVoice(SealAssets.Clip("celebrate"), 0.9f, (stage >= 3) ? 0.8f : 1f); break; case SealAct.Pancake: PlaySfx(SealAssets.Clip("pancake"), 0.9f); break; case SealAct.PetHappy: PlayVoice(SealAssets.Clip("squeak" + (variant % 3 + 1)), 0.8f, 1.05f); break; case SealAct.PetExcited: PlayVoice(SealAssets.Clip("honk2"), 0.9f, 1.3f); PlaySfx(SealAssets.Clip("squeak2"), 0.7f); break; case SealAct.Talk: switch (variant) { case 101: PlayVoice(SealAssets.Clip("honk2"), 0.9f, pitch); break; case 102: PlayVoice(SealAssets.Clip("weird2"), 0.8f, pitch); break; default: if (variant < SealAssets.Phrases.Length) { PlayVoice(SealAssets.Clip("phrase" + variant), 1f, pitch); Say(SealAssets.Phrases[variant]); } break; case 100: break; } break; case SealAct.Scream: PlayVoice(SealAssets.Clip((variant % 2 == 0) ? "scream1" : "scream2"), 1f, 1f); break; case SealAct.Transform: PlayVoice(SealAssets.Clip("transform"), (variant >= 4) ? 0.5f : 1f, 1f); if (variant >= 4) { Say("MADNESS!!!"); PlayEvilVoice(); } break; case SealAct.StareWall: case SealAct.GoToCorpse: case SealAct.PetFreeze: case SealAct.Chase: break; } } private void PlayEvilVoice() { AudioClip val = SealAssets.Clip("evil"); nextEvilVoice = Time.time + val.length + 1.2f; PlayVoice(val, 1f, 1f); } private void Say(string text) { if ((Object)(object)speech != (Object)null) { speech.Show(text, 2.6f); } } internal void PlayVoice(AudioClip clip, float volume, float pitch) { base.creatureVoice.pitch = Mathf.Clamp(pitch, 0.4f, 2f); base.creatureVoice.PlayOneShot(clip, volume); } internal void PlaySfx(AudioClip clip, float volume) { base.creatureSFX.PlayOneShot(clip, volume); } public override void OnCollideWithPlayer(Collider other) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); if (!base.isEnemyDead && Act == SealAct.Chase && Stage >= 4 && !(timeSinceHittingLocalPlayer < 1f) && !(base.stunNormalizedTimer > 0f)) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if (!((Object)(object)val == (Object)null)) { timeSinceHittingLocalPlayer = 0f; val.DamagePlayer(syncedDamage, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); } } } 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) { return; } base.enemyHP -= force; if (((NetworkBehaviour)this).IsOwner) { if (base.enemyHP <= 0) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } else if (((NetworkBehaviour)this).IsServer) { AddMadness(12f); } } } public override void KillEnemy(bool destroy = false) { ((EnemyAI)this).KillEnemy(destroy); Act = SealAct.Dead; ActStart = Time.time; ActDuration = 0f; ActPlayer = null; if ((Object)(object)petTrigger != (Object)null) { petTrigger.interactable = false; } if ((Object)(object)talkTrigger != (Object)null) { talkTrigger.interactable = false; } if (((NetworkBehaviour)this).IsServer && base.currentSearch != null && base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2656513498u, new RpcReceiveHandler(__rpc_handler_2656513498), "SetActClientRpc"); ((NetworkBehaviour)this).__registerRpc(639390738u, new RpcReceiveHandler(__rpc_handler_639390738), "SyncMadnessClientRpc"); ((NetworkBehaviour)this).__registerRpc(3533277252u, new RpcReceiveHandler(__rpc_handler_3533277252), "PlaySoundClientRpc"); ((NetworkBehaviour)this).__registerRpc(24095032u, new RpcReceiveHandler(__rpc_handler_24095032), "PetServerRpc"); ((NetworkBehaviour)this).__registerRpc(310578478u, new RpcReceiveHandler(__rpc_handler_310578478), "TalkServerRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_2656513498(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_004a: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { byte act = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref act, default(ForPrimitives)); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives)); int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); byte variant = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref variant, default(ForPrimitives)); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilSealAI)(object)target).SetActClientRpc(act, duration, playerId, variant, pitch); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_639390738(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); int damage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damage); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilSealAI)(object)target).SyncMadnessClientRpc(value, damage); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3533277252(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_004a: 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_005f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { byte sound = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref sound, default(ForPrimitives)); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilSealAI)(object)target).PlaySoundClientRpc(sound, pitch); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_24095032(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilSealAI)(object)target).PetServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_310578478(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilSealAI)(object)target).TalkServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EvilSealAI"; } } [BepInPlugin("EvilSealMF", "Evil Seal MF", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGuid = "EvilSealMF"; public const string ModName = "Evil Seal MF"; public const string ModVersion = "1.0.0"; public const string EnemyName = "Evil Seal MF"; internal static ManualLogSource Logger; internal static EnemyType IndoorType; internal static EnemyType OutdoorType; internal static TerminalNode InfoNode; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); SealAssets.Load(); InfoNode = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)InfoNode).name = "EvilSealMFFile"; InfoNode.creatureName = "Evil Seal MF"; InfoNode.clearPreviousText = true; InfoNode.maxCharactersToType = 35; InfoNode.displayText = "EVIL SEAL MF\n\nSigurd's danger level: starts at 0%, ends at \"RUN\"\n\nScientific name: Phoca malevola\n\nA round, squishy seal with big glossy eyes. Found inside facilities and out on the surface. It likes being petted and will answer if you talk to it, usually in something that is almost Italian or Spanish.\n\nIts behaviour gets stranger the longer it is around people. Staring, spinning and an interest in the deceased are early signs. When the eyes turn yellow it is time to be somewhere else.\n\ni petted it. it said spaghetti. jess petted it. it ate jess. do not pet it. (i am going to pet it again)\n\n"; IndoorType = CreateSeal("EvilSealMF", outside: false); OutdoorType = CreateSeal("EvilSealMFOutside", outside: true); EvilSealAI.RefreshSpawnCaps(); Enemies.RegisterEnemy(IndoorType, BoundConfig.IndoorSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, InfoNode, (TerminalKeyword)null); Enemies.RegisterEnemy(OutdoorType, BoundConfig.OutdoorSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)2, InfoNode, (TerminalKeyword)null); Logger.LogInfo((object)string.Format("{0} {1} loaded. Indoor weight {2}, outdoor weight {3}.", "Evil Seal MF", "1.0.0", BoundConfig.IndoorSpawnWeight.Value, BoundConfig.OutdoorSpawnWeight.Value)); } private static int Layer(string name, int fallback) { int num = LayerMask.NameToLayer(name); if (num >= 0) { return num; } return fallback; } private static EnemyType CreateSeal(string objectName, bool outside) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) int layer = Layer("Enemies", 19); GameObject prefab = NetworkPrefabs.CreateNetworkPrefab(objectName); prefab.layer = layer; prefab.tag = "Enemy"; NavMeshAgent obj = prefab.AddComponent<NavMeshAgent>(); obj.radius = 0.55f; obj.height = 1.3f; obj.baseOffset = 0f; obj.speed = BoundConfig.MoveSpeed.Value; obj.angularSpeed = 420f; obj.acceleration = 30f; obj.stoppingDistance = 0f; obj.autoBraking = true; obj.obstacleAvoidanceType = (ObstacleAvoidanceType)1; AudioSource creatureVoice = MakeAudio("Voice", 32f); AudioSource creatureSFX = MakeAudio("SFX", 18f); GameObject val = new GameObject("Model"); val.transform.SetParent(prefab.transform, false); val.transform.localScale = Vector3.one * 1.5f; val.layer = layer; Transform[] array = (Transform[])(object)new Transform[SealAssets.Parts.Count]; for (int i = 0; i < SealAssets.Parts.Count; i++) { SealAssets.Part part = SealAssets.Parts[i]; GameObject val2 = new GameObject(part.Name) { layer = layer }; val2.transform.SetParent((part.Parent < 0) ? val.transform : array[part.Parent], false); val2.transform.localPosition = part.Position; if ((Object)(object)part.Mesh != (Object)null) { val2.AddComponent<MeshFilter>().sharedMesh = part.Mesh; val2.AddComponent<MeshRenderer>(); } array[i] = val2.transform; } val.AddComponent<SealVisual>(); GameObject val3 = new GameObject("Eye"); val3.transform.SetParent(prefab.transform, false); val3.transform.localPosition = new Vector3(0f, 1.2f, 0.8f); GameObject val4 = new GameObject("Collision") { layer = layer, tag = "Enemy" }; val4.transform.SetParent(prefab.transform, false); BoxCollider obj2 = val4.AddComponent<BoxCollider>(); ((Collider)obj2).isTrigger = true; obj2.center = new Vector3(0f, 0.65f, 0f); obj2.size = new Vector3(1f, 1.3f, 2f); GameObject val5 = new GameObject("ScanNode") { layer = Layer("ScanNode", 22) }; val5.transform.SetParent(prefab.transform, false); val5.transform.localPosition = new Vector3(0f, 1f, 0.3f); BoxCollider obj3 = val5.AddComponent<BoxCollider>(); ((Collider)obj3).isTrigger = true; obj3.size = Vector3.one * 0.4f; ScanNodeProperties val6 = val5.AddComponent<ScanNodeProperties>(); val6.headerText = "Evil Seal MF"; val6.subText = "Pet at your own risk"; val6.nodeType = 1; val6.minRange = 1; val6.maxRange = 14; val6.requiresLineOfSight = true; val6.creatureScanID = -1; InteractTrigger petTrigger = MakeTrigger("PetTrigger", new Vector3(0f, 0.45f, -0.25f), new Vector3(1f, 0.9f, 1.5f), "Pet the seal : [LMB]"); InteractTrigger talkTrigger = MakeTrigger("TalkTrigger", new Vector3(0f, 1.2f, 0.72f), new Vector3(0.75f, 0.7f, 0.75f), "Talk to the MF : [LMB]"); EnemyType val7 = ScriptableObject.CreateInstance<EnemyType>(); ((Object)val7).name = objectName; val7.enemyName = "Evil Seal MF"; val7.enemyPrefab = prefab; val7.isOutsideEnemy = outside; val7.isDaytimeEnemy = false; val7.PowerLevel = 1f; val7.MaxCount = BoundConfig.MaxSeals.Value; val7.probabilityCurve = AnimationCurve.Constant(0f, 1f, 1f); val7.numberSpawnedFalloff = AnimationCurve.Constant(0f, 1f, 1f); val7.useNumberSpawnedFalloff = false; val7.canDie = true; val7.destroyOnDeath = false; val7.canBeStunned = true; val7.stunTimeMultiplier = 1f; val7.doorSpeedMultiplier = 1.2f; val7.loudnessMultiplier = 1f; val7.canSeeThroughFog = false; val7.pushPlayerForce = 0.3f; val7.pushPlayerDistance = 0.9f; val7.hitBodySFX = SealAssets.Clip("squeak3"); val7.stunSFX = SealAssets.Clip("weird1"); val7.deathSFX = SealAssets.Clip("die"); EvilSealAI evilSealAI = prefab.AddComponent<EvilSealAI>(); ((EnemyAI)evilSealAI).enemyType = val7; ((EnemyAI)evilSealAI).creatureVoice = creatureVoice; ((EnemyAI)evilSealAI).creatureSFX = creatureSFX; ((EnemyAI)evilSealAI).eye = val3.transform; ((EnemyAI)evilSealAI).dieSFX = SealAssets.Clip("die"); ((EnemyAI)evilSealAI).enemyHP = BoundConfig.Health.Value; ((EnemyAI)evilSealAI).AIIntervalTime = 0.2f; ((EnemyAI)evilSealAI).updatePositionThreshold = 0.35f; ((EnemyAI)evilSealAI).syncMovementSpeed = 0.2f; ((EnemyAI)evilSealAI).exitVentAnimationTime = 1f; ((EnemyAI)evilSealAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[0]; evilSealAI.petTrigger = petTrigger; evilSealAI.talkTrigger = talkTrigger; evilSealAI.scanNode = val6; val4.AddComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)evilSealAI; return val7; AudioSource MakeAudio(string n, float maxDist) { //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_001d: 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) GameObject val8 = new GameObject(n); val8.transform.SetParent(prefab.transform, false); val8.transform.localPosition = new Vector3(0f, 1f, 0.5f); AudioSource obj4 = val8.AddComponent<AudioSource>(); obj4.playOnAwake = false; obj4.spatialBlend = 1f; obj4.dopplerLevel = 0.3f; obj4.rolloffMode = (AudioRolloffMode)1; obj4.minDistance = 2f; obj4.maxDistance = maxDist; return obj4; } InteractTrigger MakeTrigger(string n, Vector3 centre, Vector3 size, string tip) { //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_0018: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) GameObject val8 = new GameObject(n) { layer = Layer("InteractableObject", 9), tag = "InteractTrigger" }; val8.transform.SetParent(prefab.transform, false); BoxCollider obj4 = val8.AddComponent<BoxCollider>(); ((Collider)obj4).isTrigger = true; obj4.center = centre; obj4.size = size; InteractTrigger obj5 = val8.AddComponent<InteractTrigger>(); obj5.hoverTip = tip; obj5.disabledHoverTip = ""; obj5.holdTip = ""; obj5.interactable = true; obj5.oneHandedItemAllowed = true; obj5.twoHandedItemAllowed = true; obj5.holdInteraction = false; obj5.timeToHold = 0.3f; obj5.interactCooldown = true; obj5.cooldownTime = 0.8f; obj5.specialCharacterAnimation = false; obj5.triggerOnce = false; return obj5; } } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } internal static class SealAssets { internal class Part { public string Name = ""; public int Parent; public int Material; public Vector3 Position; public Mesh? Mesh; } internal const int MatSkin = 0; internal const int MatEye = 1; internal const int MatWhite = 2; internal const int MatNose = 3; internal const int MatCheek = 4; internal const int MatMouth = 5; internal const int MatTongue = 6; internal static readonly List<Part> Parts = new List<Part>(); internal static Texture2D SkinTexture = null; internal static readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>(); private static Material?[] materials = (Material?[])(object)new Material[7]; internal static readonly string[] Phrases = new string[7] { "MAMMA MIAAAAA!", "¿QUÉ PASA, SEÑOR?!", "Bababooey!", "SPAGHETTI!", "POR FAVORRR!", "BONGO BONGO!", "AAAA BELLISSIMO!" }; internal static AudioClip Clip(string name) { return Clips[name]; } internal static void Load() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { using Stream stream = executingAssembly.GetManifestResourceStream(text); byte[] array = new byte[stream.Length]; for (int j = 0; j < array.Length; j += stream.Read(array, j, array.Length - j)) { } if (text.EndsWith("seal.bin", StringComparison.Ordinal)) { LoadModel(array); } else if (text.EndsWith("seal_skin.png", StringComparison.Ordinal)) { SkinTexture = new Texture2D(2, 2, (TextureFormat)4, true) { name = "EvilSealSkin", wrapMode = (TextureWrapMode)0 }; ImageConversion.LoadImage(SkinTexture, array); Object.DontDestroyOnLoad((Object)(object)SkinTexture); } else if (text.EndsWith(".wav", StringComparison.Ordinal)) { string text2 = text.Split('.')[^2]; AudioClip val = WavToClip(text2, array); Object.DontDestroyOnLoad((Object)(object)val); Clips[text2] = val; } } if (Parts.Count == 0 || (Object)(object)SkinTexture == (Object)null) { throw new InvalidOperationException("Embedded seal model or texture is missing."); } } private static void LoadModel(byte[] data) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown using BinaryReader binaryReader = new BinaryReader(new MemoryStream(data)); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(5)) != "SEAL1") { throw new InvalidDataException("seal.bin has the wrong header."); } int num = binaryReader.ReadInt32(); for (int i = 0; i < num; i++) { Part part = new Part(); part.Name = Encoding.ASCII.GetString(binaryReader.ReadBytes(binaryReader.ReadByte())); part.Parent = binaryReader.ReadInt16(); part.Material = binaryReader.ReadByte(); part.Position = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); int num2 = binaryReader.ReadInt32(); Vector3[] array = (Vector3[])(object)new Vector3[num2]; Vector3[] array2 = (Vector3[])(object)new Vector3[num2]; Vector2[] array3 = (Vector2[])(object)new Vector2[num2]; for (int j = 0; j < num2; j++) { array[j] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); array2[j] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); array3[j] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); } int num3 = binaryReader.ReadInt32(); int[] array4 = new int[num3]; for (int k = 0; k < num3; k++) { array4[k] = binaryReader.ReadUInt16(); } if (num2 > 0) { Mesh val = new Mesh { name = "EvilSeal_" + part.Name }; val.vertices = array; val.normals = array2; val.uv = array3; val.triangles = array4; val.RecalculateBounds(); Object.DontDestroyOnLoad((Object)(object)val); part.Mesh = val; } Parts.Add(part); } } private static AudioClip WavToClip(string name, byte[] wav) { int num = 1; int num2 = 22050; int i = 12; int num3 = -1; int num4 = 0; int num5; for (; i + 8 <= wav.Length; i += 8 + num5 + (num5 & 1)) { string text = Encoding.ASCII.GetString(wav, i, 4); num5 = BitConverter.ToInt32(wav, i + 4); if (text == "fmt ") { num = BitConverter.ToInt16(wav, i + 10); num2 = BitConverter.ToInt32(wav, i + 12); } else if (text == "data") { num3 = i + 8; num4 = Math.Min(num5, wav.Length - num3); break; } } if (num3 < 0) { throw new InvalidDataException("No data chunk in " + name); } int num6 = num4 / 2; float[] array = new float[num6]; for (int j = 0; j < num6; j++) { array[j] = (float)BitConverter.ToInt16(wav, num3 + j * 2) / 32768f; } AudioClip obj = AudioClip.Create("EvilSeal_" + name, num6 / num, num, num2, false); obj.SetData(array, 0); return obj; } internal static Material? GetMaterial(int id) { //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_0056: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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) Material val = materials[id]; if ((Object)(object)val != (Object)null) { return val; } Shader val2 = Shader.Find("HDRP/Lit"); if ((Object)(object)val2 == (Object)null) { Plugin.Logger.LogError((object)"Shader HDRP/Lit was not found; the seal will be drawn without its materials."); return null; } val = new Material(val2) { name = "EvilSealMat" + id }; float num = 0.3f; Color white = default(Color); switch (id) { case 0: white = Color.white; num = 0.55f; val.SetTexture("_BaseColorMap", (Texture)(object)SkinTexture); break; case 1: ((Color)(ref white))..ctor(0.01f, 0.01f, 0.015f); num = 0.95f; val.SetFloat("_EmissiveExposureWeight", 0f); val.SetColor("_EmissiveColor", Color.black); break; case 2: ((Color)(ref white))..ctor(0.95f, 0.95f, 0.95f); num = 0.6f; break; case 3: ((Color)(ref white))..ctor(0.04f, 0.035f, 0.035f); num = 0.8f; break; case 4: ((Color)(ref white))..ctor(0.95f, 0.38f, 0.45f); break; case 5: ((Color)(ref white))..ctor(0.22f, 0.02f, 0.04f); break; default: ((Color)(ref white))..ctor(0.95f, 0.45f, 0.55f); num = 0.7f; break; } val.SetColor("_BaseColor", white); val.SetFloat("_Smoothness", num); val.SetFloat("_Metallic", 0f); Object.DontDestroyOnLoad((Object)(object)val); materials[id] = val; return val; } } internal class SealSpeech : MonoBehaviour { private TextMeshPro text; private float hideAt; internal static SealSpeech? TryCreate(Transform seal) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) try { GameObject val = new GameObject("SealSpeech"); val.transform.SetParent(seal, false); val.transform.localPosition = new Vector3(0f, 2.15f, 0.4f); SealSpeech sealSpeech = val.AddComponent<SealSpeech>(); sealSpeech.Build(); return sealSpeech; } catch (Exception ex) { Plugin.Logger.LogWarning((object)("Speech text disabled: " + ex.Message)); return null; } } private void Build() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) text = ((Component)this).gameObject.AddComponent<TextMeshPro>(); if ((Object)(object)HUDManager.Instance != (Object)null && HUDManager.Instance.controlTipLines != null && HUDManager.Instance.controlTipLines.Length != 0) { ((TMP_Text)text).font = ((TMP_Text)HUDManager.Instance.controlTipLines[0]).font; } ((TMP_Text)text).fontSize = 3.2f; ((TMP_Text)text).alignment = (TextAlignmentOptions)514; ((TMP_Text)text).enableWordWrapping = false; ((TMP_Text)text).color = new Color(1f, 0.92f, 0.3f); ((TMP_Text)text).text = ""; } internal void Show(string message, float seconds) { ((TMP_Text)text).text = message; hideAt = Time.time + seconds; } private void LateUpdate() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (hideAt <= 0f) { return; } if (Time.time >= hideAt) { ((TMP_Text)text).text = ""; hideAt = 0f; return; } Camera val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.activeCamera : null); if ((Object)(object)val != (Object)null) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - ((Component)val).transform.position); } } } public class SealVisual : MonoBehaviour { private EvilSealAI ai; private Transform body; private Transform head; private Transform flipperL; private Transform flipperR; private Transform tail; private Transform mouth; private Transform tongue; private Transform eyeL; private Transform eyeR; private Vector3 headRest; private Material? eyeMat; private Vector3 lastPos; private float speed; private float hopPhase; private float lastHopSin; private float lastBounceSound; private float seed; private float lookYaw; private float lookPitch; private float jerkUntil; private float nextJerk; private float jerkYaw; private float jerkRoll; private Color lastEye = Color.clear; private static readonly Color EyeBlack = new Color(0.01f, 0.01f, 0.015f); private static readonly Color EyeYellow = new Color(1f, 0.85f, 0.05f); internal void Init(EvilSealAI owner) { //IL_00d4: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown ai = owner; body = ((Component)this).transform.Find("BodyPivot"); head = body.Find("HeadPivot"); flipperL = body.Find("FlipperL"); flipperR = body.Find("FlipperR"); tail = body.Find("Tail"); mouth = head.Find("Mouth"); tongue = head.Find("Tongue"); eyeL = head.Find("EyeL"); eyeR = head.Find("EyeR"); headRest = head.localPosition; MeshRenderer component = ((Component)eyeL).GetComponent<MeshRenderer>(); if ((Object)(object)((Renderer)component).sharedMaterial != (Object)null) { eyeMat = new Material(((Renderer)component).sharedMaterial); ((Renderer)component).sharedMaterial = eyeMat; ((Renderer)((Component)eyeR).GetComponent<MeshRenderer>()).sharedMaterial = eyeMat; } lastPos = ((Component)ai).transform.position; seed = Random.value * 100f; nextJerk = Time.time + 3f; } private void OnDestroy() { if ((Object)(object)eyeMat != (Object)null) { Object.Destroy((Object)(object)eyeMat); } } private static float Noise(float t, float s) { return Mathf.PerlinNoise(t, s) * 2f - 1f; } private void LateUpdate() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0cea: Unknown result type (might be due to invalid IL or missing references) //IL_0cf1: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0cf6: Unknown result type (might be due to invalid IL or missing references) //IL_0cfe: Unknown result type (might be due to invalid IL or missing references) //IL_0d0c: Unknown result type (might be due to invalid IL or missing references) //IL_0d19: Unknown result type (might be due to invalid IL or missing references) //IL_0d20: Unknown result type (might be due to invalid IL or missing references) //IL_0d3c: Unknown result type (might be due to invalid IL or missing references) //IL_0d4a: Unknown result type (might be due to invalid IL or missing references) //IL_0d4f: Unknown result type (might be due to invalid IL or missing references) //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0d6c: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0db8: Unknown result type (might be due to invalid IL or missing references) //IL_0dbf: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_0df8: Unknown result type (might be due to invalid IL or missing references) //IL_0e14: Unknown result type (might be due to invalid IL or missing references) //IL_0e55: Unknown result type (might be due to invalid IL or missing references) //IL_0e2d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Unknown result type (might be due to invalid IL or missing references) //IL_0b77: Unknown result type (might be due to invalid IL or missing references) //IL_0b7c: Unknown result type (might be due to invalid IL or missing references) //IL_0b86: Unknown result type (might be due to invalid IL or missing references) //IL_0b8b: Unknown result type (might be due to invalid IL or missing references) //IL_0bac: Unknown result type (might be due to invalid IL or missing references) //IL_0bb4: Unknown result type (might be due to invalid IL or missing references) //IL_0bb6: Unknown result type (might be due to invalid IL or missing references) //IL_0bbc: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0bcf: Unknown result type (might be due to invalid IL or missing references) //IL_0bf2: Unknown result type (might be due to invalid IL or missing references) //IL_0bf9: Unknown result type (might be due to invalid IL or missing references) //IL_0c00: Unknown result type (might be due to invalid IL or missing references) //IL_0c07: Unknown result type (might be due to invalid IL or missing references) //IL_0c0c: Unknown result type (might be due to invalid IL or missing references) //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) //IL_0e6e: Unknown result type (might be due to invalid IL or missing references) //IL_0ea3: Unknown result type (might be due to invalid IL or missing references) //IL_0eaa: Unknown result type (might be due to invalid IL or missing references) //IL_0eaf: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Unknown result type (might be due to invalid IL or missing references) //IL_0eb7: Unknown result type (might be due to invalid IL or missing references) //IL_0f53: Unknown result type (might be due to invalid IL or missing references) //IL_0f31: Unknown result type (might be due to invalid IL or missing references) //IL_0f36: Unknown result type (might be due to invalid IL or missing references) //IL_0f3d: Unknown result type (might be due to invalid IL or missing references) //IL_0f58: Unknown result type (might be due to invalid IL or missing references) //IL_0f5a: Unknown result type (might be due to invalid IL or missing references) //IL_0f64: Unknown result type (might be due to invalid IL or missing references) //IL_0f69: Unknown result type (might be due to invalid IL or missing references) //IL_0f6b: Unknown result type (might be due to invalid IL or missing references) //IL_0f6d: Unknown result type (might be due to invalid IL or missing references) //IL_0f6f: Unknown result type (might be due to invalid IL or missing references) //IL_0f75: Unknown result type (might be due to invalid IL or missing references) //IL_0f82: Unknown result type (might be due to invalid IL or missing references) //IL_0f84: Unknown result type (might be due to invalid IL or missing references) //IL_0f86: Unknown result type (might be due to invalid IL or missing references) //IL_0f8b: Unknown result type (might be due to invalid IL or missing references) //IL_0f9b: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ai == (Object)null) { return; } float num = Mathf.Max(Time.deltaTime, 0.0001f); float time = Time.time; SealAct act = ai.Act; float num2 = time - ai.ActStart; float num3 = ((ai.ActDuration > 0f) ? Mathf.Clamp01(num2 / ai.ActDuration) : 0f); float madness = ai.Madness01; int stage = ai.Stage; bool flag = act == SealAct.Dead; Vector3 position = ((Component)ai).transform.position; Vector3 val = position - lastPos; val.y = 0f; lastPos = position; speed = Mathf.Lerp(speed, Mathf.Min(((Vector3)(ref val)).magnitude / num, 20f), 8f * num); float num4 = (flag ? 0f : Mathf.Clamp01(speed / 1.2f)); bool flag2 = act == SealAct.Chase || act == SealAct.FakeCharge || act == SealAct.PrankChase; hopPhase += speed * 2.2f * num; float num5 = Mathf.Sin(hopPhase); float num6 = Mathf.Abs(num5) * num4; float num7 = num6 * (flag2 ? 0.2f : 0.13f) * (1f + 0.4f * madness); float num8 = 1f + 0.16f * num6 - 0.1f * (1f - Mathf.Abs(num5)) * num4 + 0.02f * Mathf.Sin(time * 2f + seed); float num9 = 1f; float num10 = num4 * Mathf.Sin(hopPhase * 2f) * 5f; float num11 = 0f; float num12 = 0f; float num13 = Mathf.Sin(time * 0.9f + seed) * 3f; float num14 = Mathf.Sin(time * 0.6f + seed) * 9f; float num15 = 0f; float num16 = 1f; float num17 = 6f + 34f * num6; float num18 = Mathf.Sin(time * 3f + seed) * 10f + num4 * num5 * 22f; float num19 = 0f; float num20 = 0f; float num21 = 1f; float num22 = 0f; bool flag3 = false; bool flag4 = false; if (num4 > 0.5f && num5 > 0f != lastHopSin > 0f && time - lastBounceSound > 0.22f) { lastBounceSound = time; ai.PlaySfx(SealAssets.Clip("bounce"), flag2 ? 0.45f : 0.28f); } lastHopSin = num5; switch (act) { case SealAct.Follow: flag3 = true; break; case SealAct.StarePlayer: case SealAct.FakeSqueak: case SealAct.PetFreeze: flag3 = true; flag4 = true; num21 = 1.2f; break; case SealAct.StareWall: flag4 = true; break; case SealAct.HeadTilt: flag3 = true; num15 = 28f * Mathf.Sin(MathF.PI * num3) * ((ai.ActVariant % 2 == 0) ? 1f : (-1f)); break; case SealAct.Twitch: num12 = Noise(time * 22f, seed) * 14f; num14 += Noise(time * 27f, seed + 9f) * 40f; num15 = Noise(time * 19f, seed + 5f) * 25f; num22 = 0.03f; num17 = 20f + Noise(time * 30f, seed + 2f) * 30f; break; case SealAct.Spin: num11 = 360f * (float)(2 + ai.ActVariant % 2) * Mathf.SmoothStep(0f, 1f, num3); num17 = 45f; break; case SealAct.ItalianMeltdown: num11 = 1800f * num3; num19 = 1f; num13 = -28f; num17 = 70f * Mathf.Abs(Mathf.Sin(num2 * 20f)); num21 = 1.25f; break; case SealAct.SpanishBreakdown: { float num24 = Mathf.Abs(Mathf.Sin(num2 * 13f)); num7 = num24 * 0.38f; num8 = 0.85f + 0.4f * num24; num12 = Mathf.Sin(num2 * 9f) * 12f; num17 = 60f * num24; num19 = ((num2 < 1.2f) ? (0.4f + 0.6f * Mathf.Abs(Mathf.Sin(num2 * 22f))) : 0.3f); break; } case SealAct.FakeCharge: num10 += 10f; num19 = 0.7f; flag3 = true; break; case SealAct.PrankChase: num10 += 6f; num19 = 0.3f; flag3 = true; num12 = Mathf.Sin(num2 * 8f) * 8f; break; case SealAct.Chase: num10 += 12f; num19 = 0.6f + 0.4f * Mathf.Abs(Mathf.Sin(num2 * 9f)); flag3 = true; num15 = Noise(time * 12f, seed) * 25f; num12 = Noise(time * 9f, seed + 3f) * 10f; num17 += 30f; num21 = 1.3f; break; case SealAct.GoToCorpse: num13 = 12f; break; case SealAct.Sniff: num13 = 38f + Mathf.Sin(num2 * 18f) * 7f; num14 = Mathf.Sin(num2 * 5f) * 15f; break; case SealAct.Taste: num13 = 46f; num19 = 0.5f; num20 = 0.5f + 0.5f * Mathf.Sin(num2 * 16f); num15 = Mathf.Sin(num2 * 16f) * 6f; break; case SealAct.Celebrate: { float num28 = Mathf.Abs(Mathf.Sin(num2 * 10f)); num7 = num28 * 0.28f; num8 = 0.9f + 0.3f * num28; num11 = 360f * num3; num17 = 65f * Mathf.Abs(Mathf.Sin(num2 * 20f)); num19 = 0.6f; num13 = -20f; break; } case SealAct.Pancake: if (num3 < 0.12f) { num8 = Mathf.Lerp(1f, 0.2f, num3 / 0.12f); } else if (num3 < 0.55f) { num8 = 0.2f + 0.02f * Mathf.Sin(num2 * 30f); } else { float num27 = (num3 - 0.55f) / 0.45f; num8 = 1f + 0.55f * Mathf.Exp(-5f * num27) * Mathf.Cos(18f * num27) - 1.35f * Mathf.Exp(-14f * num27); } flag4 = true; num21 = 1.15f; break; case SealAct.PetHappy: { float num26 = Mathf.Abs(Mathf.Sin(num2 * 12f)); num7 = num26 * 0.16f; num8 = 0.92f + 0.22f * num26; num15 = Mathf.Sin(num2 * 10f) * 14f; num17 = 50f * num26; flag3 = true; num18 = Mathf.Sin(num2 * 25f) * 30f; break; } case SealAct.PetExcited: { float num25 = Mathf.Abs(Mathf.Sin(num2 * 20f)); num7 = num25 * 0.32f; num8 = 0.85f + 0.4f * num25; num11 = 720f * num3; num17 = 75f * num25; num19 = 0.5f; num18 = Mathf.Sin(num2 * 40f) * 40f; num21 = 1.2f; break; } case SealAct.Talk: flag3 = true; if (ai.ActVariant == 100) { flag4 = true; num21 = 1.15f; } else if (num2 < 1.1f) { num19 = 0.25f + 0.75f * Mathf.Abs(Mathf.Sin(num2 * 21f)); num13 = -10f; num15 = Mathf.Sin(num2 * 7f) * 8f; } break; case SealAct.Scream: flag3 = true; num19 = 1f; num13 = -30f; num16 = 1.2f; num22 = 0.035f; num17 = 55f; num21 = 1.35f; break; case SealAct.Transform: num22 = 0.05f; num9 = 1f + 0.3f * Mathf.Sin(MathF.PI * num3); num15 = Noise(time * 30f, seed) * 35f; num12 = Noise(time * 26f, seed + 4f) * 18f; num19 = 0.8f; num21 = 1f + 0.5f * Mathf.Sin(MathF.PI * num3); break; case SealAct.Dead: { float num23 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(num2 / 0.6f)); num12 = 90f * num23; num7 = 0.3f * num23; num8 = 1f - 0.15f * num23; num13 = 15f * num23; num14 = 0f; num17 = 0f; num18 = 0f; num20 = num23; num19 = 0.4f * num23; break; } } if (flag4) { num13 = 0f; num14 = 0f; num18 = 0f; if (act != SealAct.Pancake) { num8 = 1f; } } if (!flag) { if (stage >= 2 && time >= nextJerk) { nextJerk = time + Random.Range(2.5f, 7f) / (float)(stage - 1); jerkUntil = time + 0.14f; jerkYaw = Random.Range(-35f, 35f); jerkRoll = Random.Range(-20f, 20f); } if (time < jerkUntil) { num14 += jerkYaw; num15 += jerkRoll; num12 += jerkRoll * 0.3f; } if (stage >= 3) { float num29 = Mathf.InverseLerp(0.5f, 1f, madness); num22 = Mathf.Max(num22, 0.004f + 0.014f * num29); num15 += Noise(time * 14f, seed + 7f) * 10f * num29; } if (stage >= 4) { num21 = Mathf.Max(num21, 1.25f + 0.08f * Mathf.Sin(time * 9f)); } } float num30 = 0f; float num31 = 0f; if (flag3 && (Object)(object)ai.ActPlayer != (Object)null && !ai.ActPlayer.isPlayerDead) { Vector3 val2 = (((Object)(object)ai.ActPlayer.gameplayCamera != (Object)null) ? ((Component)ai.ActPlayer.gameplayCamera).transform.position : (((Component)ai.ActPlayer).transform.position + Vector3.up * 2f)); Vector3 val3 = ((Component)this).transform.InverseTransformPoint(val2) - headRest; num30 = Mathf.Clamp(Mathf.Atan2(val3.x, val3.z) * 57.29578f, -80f, 80f); float y = val3.y; Vector2 val4 = new Vector2(val3.x, val3.z); num31 = Mathf.Clamp((0f - Mathf.Atan2(y, ((Vector2)(ref val4)).magnitude)) * 57.29578f, -40f, 30f); } lookYaw = Mathf.LerpAngle(lookYaw, num30, 9f * num); lookPitch = Mathf.Lerp(lookPitch, num31, 9f * num); num8 = Mathf.Clamp(num8, 0.15f, 1.8f); float num32 = Mathf.Min(1f / Mathf.Sqrt(num8), 2f); Vector3 val5 = ((num22 > 0f) ? (new Vector3(Noise(time * 40f, seed), Noise(time * 43f, seed + 1f) * 0.5f, Noise(time * 37f, seed + 2f)) * num22) : Vector3.zero); body.localPosition = new Vector3(val5.x, Mathf.Max(0f, num7 + val5.y), val5.z); body.localRotation = Quaternion.Euler(0f, num11, 0f) * Quaternion.Euler(num10, 0f, num12); body.localScale = new Vector3(num32, num8, num32) * num9; head.localRotation = Quaternion.Euler(num13 + lookPitch, num14 + lookYaw, num15); head.localScale = new Vector3(1f / num32, 1f / num8, 1f / num32) * num16; flipperR.localRotation = Quaternion.Euler(0f, 0f, num17); flipperL.localRotation = Quaternion.Euler(0f, 0f, 0f - num17); tail.localRotation = Quaternion.Euler(0f, num18, 0f); mouth.localScale = (Vector3)((num19 > 0.02f) ? new Vector3(0.7f + 0.5f * num19, 0.3f + 1.5f * num19, 1f) : Vector3.zero); tongue.localScale = (Vector3)((num20 > 0.02f) ? new Vector3(1f, 1f, 0.3f + 1.3f * num20) : Vector3.zero); Transform obj = eyeL; Vector3 localScale = (eyeR.localScale = Vector3.one * num21); obj.localScale = localScale; if ((Object)(object)eyeMat != (Object)null) { float num33 = (flag ? 0f : Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.42f, 0.78f, madness))); float num34 = (flag ? 0f : ((stage >= 4) ? (3.2f + 1.2f * Mathf.Sin(time * 8f)) : 1.6f)); Color val7 = (Color)(flag ? new Color(0.25f, 0.25f, 0.25f) : Color.Lerp(EyeBlack, EyeYellow, num33)); Color val8 = EyeYellow * (num33 * num34); if (val7 + val8 != lastEye) { lastEye = val7 + val8; eyeMat.SetColor("_BaseColor", val7); eyeMat.SetColor("_EmissiveColor", val8); } } } } } namespace EvilSealMF.Configuration { public class PluginConfig { public ConfigEntry<int> IndoorSpawnWeight; public ConfigEntry<int> OutdoorSpawnWeight; public ConfigEntry<int> MaxSeals; public ConfigEntry<float> MadnessSpeed; public ConfigEntry<float> StartingMadness; public ConfigEntry<float> MoveSpeed; public ConfigEntry<float> ChaseSpeed; public ConfigEntry<int> AttackDamage; public ConfigEntry<int> Health; public ConfigEntry<float> SoundVolume; public ConfigEntry<float> EventFrequency; public ConfigEntry<bool> ShowSpeechText; public PluginConfig(ConfigFile cfg) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown IndoorSpawnWeight = cfg.Bind<int>("Spawning", "Indoor spawn weight", 25, new ConfigDescription("Spawn chance weight inside facilities, relative to other indoor enemies. 0 = never, 100+ = very common. Host's value is used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); OutdoorSpawnWeight = cfg.Bind<int>("Spawning", "Outdoor spawn weight", 15, new ConfigDescription("Spawn chance weight on the moon's surface, relative to other outdoor enemies. 0 = never. Host's value is used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); MaxSeals = cfg.Bind<int>("Spawning", "Maximum seals", 2, new ConfigDescription("Maximum number of seals alive on a moon at once, indoor and outdoor combined. Host's value is used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())); MadnessSpeed = cfg.Bind<float>("Madness", "Madness escalation speed", 1f, new ConfigDescription("Multiplier for every madness gain. At 1.0 a seal left alone enters MADNESS (stage 4) after roughly 5 minutes; petting, talking, hitting it and corpses make it faster. 0 freezes madness.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); StartingMadness = cfg.Bind<float>("Madness", "Starting madness", 0f, new ConfigDescription("Madness (0-100) a seal spawns with. 75 or more spawns it already hostile; useful for testing.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); EventFrequency = cfg.Bind<float>("Madness", "Random event frequency", 1f, new ConfigDescription("How often the seal does something on its own (stares, spins, meltdowns, fake attacks...). 2.0 = twice as often, 0.5 = half.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); MoveSpeed = cfg.Bind<float>("Movement", "Movement speed", 3.5f, new ConfigDescription("Wandering speed. Gets a little faster in the later madness stages.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 15f), Array.Empty<object>())); ChaseSpeed = cfg.Bind<float>("Movement", "Chase speed", 8f, new ConfigDescription("Speed while chasing players in MADNESS (also used for fake attacks and prank chases).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 25f), Array.Empty<object>())); AttackDamage = cfg.Bind<int>("Combat", "Attack damage", 30, new ConfigDescription("Damage per bite in MADNESS (players have 100 health). The seal can bite about once a second.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); Health = cfg.Bind<int>("Combat", "Health", 6, new ConfigDescription("Shovel hits needed to kill the seal. Every hit also makes it madder.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); SoundVolume = cfg.Bind<float>("Audio", "Sound volume", 1f, new ConfigDescription("Volume of all seal sounds. This one is per player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); ShowSpeechText = cfg.Bind<bool>("Audio", "Show speech text", true, "Show what the seal is shouting as floating text above it. This one is per player."); ClearUnusedEntries(cfg); } private void ClearUnusedEntries(ConfigFile cfg) { if (((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(cfg, null) is Dictionary<ConfigDefinition, string> dictionary) { dictionary.Clear(); cfg.Save(); } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace EvilSealMF.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }