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 EvilTimKeyboard v1.0.0
BepInEx/plugins/EvilTimKeyboard/EvilTimKeyboard.dll
Decompiled 40 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using 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.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EvilTimKeyboard.NetcodePatcher; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; using UnityEngine.Rendering; [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("EvilTimKeyboard")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Giant floating keyboard enemy for Lethal Company.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EvilTimKeyboard")] [assembly: AssemblyTitle("EvilTimKeyboard")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EvilTimKeyboard { internal static class AudioLibrary { public const string Clack1Name = "keyboardclack1"; public const string Clack2Name = "keyboardclack2"; public const string Clack3Name = "keyboardclack3"; public const string AngryName = "keyboardclackAngry"; public const string AttackName = "Keyboardattack"; public static readonly AudioClip[] Clacks = (AudioClip[])(object)new AudioClip[3]; public static AudioClip Angry; public static AudioClip Attack; private static readonly string[] Extensions = new string[3] { ".mp3", ".ogg", ".wav" }; public static int LoadedCount { get { int num = 0; AudioClip[] clacks = Clacks; foreach (AudioClip val in clacks) { if ((Object)(object)val != (Object)null) { num++; } } if ((Object)(object)Angry != (Object)null) { num++; } if ((Object)(object)Attack != (Object)null) { num++; } return num; } } public static void Load(string pluginDirectory, AssetBundle bundle) { Clacks[0] = LoadOne("keyboardclack1", pluginDirectory, bundle); Clacks[1] = LoadOne("keyboardclack2", pluginDirectory, bundle); Clacks[2] = LoadOne("keyboardclack3", pluginDirectory, bundle); Angry = LoadOne("keyboardclackAngry", pluginDirectory, bundle); Attack = LoadOne("Keyboardattack", pluginDirectory, bundle); } private static AudioClip LoadOne(string name, string pluginDirectory, AssetBundle bundle) { AudioClip val = null; if ((Object)(object)bundle != (Object)null) { try { val = bundle.LoadAsset<AudioClip>(name); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not read '" + name + "' from the asset bundle: " + ex.Message)); } if ((Object)(object)val != (Object)null) { Plugin.Debug("Sound '" + name + "' loaded from asset bundle."); } } if ((Object)(object)val == (Object)null) { string text = FindAudioFile(name, pluginDirectory); if (text != null) { val = LoadClipFromFile(text, name); if ((Object)(object)val != (Object)null) { Plugin.Debug("Sound '" + name + "' loaded from " + text); } } } if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)("Sound '" + name + "' was not found. Expected it inside the 'eviltimekeyboardassets' bundle or as '" + Path.Combine("Audio", name + ".mp3") + "' next to EvilTimKeyboard.dll. The enemy will be silent for this sound.")); return null; } ((Object)val).name = name; ((Object)val).hideFlags = (HideFlags)61; return val; } private static string FindAudioFile(string name, string pluginDirectory) { try { string[] array = new string[2] { Path.Combine(pluginDirectory, "Audio"), pluginDirectory }; string[] array2 = array; foreach (string directory in array2) { string text = FindInDirectory(directory, name, SearchOption.TopDirectoryOnly); if (text != null) { return text; } } string name2 = new DirectoryInfo(pluginDirectory).Name; if (!string.Equals(name2, "plugins", StringComparison.OrdinalIgnoreCase)) { return FindInDirectory(pluginDirectory, name, SearchOption.AllDirectories); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Error while searching for sound '" + name + "': " + ex.Message)); } return null; } private static string FindInDirectory(string directory, string name, SearchOption option) { if (!Directory.Exists(directory)) { return null; } string[] files = Directory.GetFiles(directory, "*", option); foreach (string text in files) { string ext = Path.GetExtension(text); if (Array.FindIndex(Extensions, (string x) => string.Equals(x, ext, StringComparison.OrdinalIgnoreCase)) >= 0 && string.Equals(Path.GetFileNameWithoutExtension(text), name, StringComparison.OrdinalIgnoreCase)) { return text; } } return null; } private static AudioType AudioTypeFor(string file) { string text = Path.GetExtension(file).ToLowerInvariant(); if (!(text == ".ogg")) { if (text == ".wav") { return (AudioType)20; } return (AudioType)13; } return (AudioType)14; } private static AudioClip LoadClipFromFile(string file, string name) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Invalid comparison between Unknown and I4 try { string absoluteUri = new Uri(file).AbsoluteUri; UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(absoluteUri, AudioTypeFor(file)); try { DownloadHandler downloadHandler = audioClip.downloadHandler; DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)(object)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null); if (val != null) { val.streamAudio = false; } UnityWebRequestAsyncOperation val2 = audioClip.SendWebRequest(); Stopwatch stopwatch = Stopwatch.StartNew(); while (!((AsyncOperation)val2).isDone && stopwatch.ElapsedMilliseconds < 8000) { Thread.Sleep(1); } if (!((AsyncOperation)val2).isDone) { Plugin.Log.LogError((object)("Timed out while loading sound file " + file)); return null; } if ((int)audioClip.result != 1) { Plugin.Log.LogError((object)("Failed to load sound file " + file + ": " + audioClip.error)); return null; } AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); if ((Object)(object)content == (Object)null || (int)content.loadState == 3) { Plugin.Log.LogError((object)("Sound file " + file + " could not be decoded.")); return null; } return content; } finally { ((IDisposable)audioClip)?.Dispose(); } } catch (Exception arg) { Plugin.Log.LogError((object)$"Exception while loading sound '{name}' from {file}: {arg}"); return null; } } } internal static class EnemyPrefabFactory { public const int LayerMapRadar = 14; public const int LayerEnemies = 19; public const int LayerScanNode = 22; public const string ModelRootName = "ModelRoot"; public const string KeyboardMeshName = "KeyboardMesh"; public const string EyeName = "Eye"; public const string CollisionName = "Collision"; public const string ScanNodeName = "ScanNode"; public const string MapDotName = "MapDot"; public const string VoiceName = "CreatureVoice"; public const string SfxName = "CreatureSFX"; public const float RestPitch = -14f; public static GameObject CreatePrefab() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Expected O, but got Unknown //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Expected O, but got Unknown //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Expected O, but got Unknown GameObject val = NetworkPrefabs.CreateNetworkPrefab("EvilTimKeyboard"); val.layer = 19; NetworkObject component = val.GetComponent<NetworkObject>(); component.DontDestroyWithOwner = true; NavMeshAgent val2 = val.AddComponent<NavMeshAgent>(); val2.radius = 0.5f; val2.height = 1.4f; val2.baseOffset = 0f; val2.speed = 2.3f; val2.acceleration = 14f; val2.angularSpeed = 220f; val2.stoppingDistance = 0f; val2.autoBraking = true; val2.obstacleAvoidanceType = (ObstacleAvoidanceType)4; Animator val3 = val.AddComponent<Animator>(); ((Behaviour)val3).enabled = false; GameObject val4 = CreateChild(val, "ModelRoot", 19); val4.transform.localPosition = new Vector3(0f, 0.3f, 0f); val4.transform.localRotation = Quaternion.Euler(-14f, 0f, 0f); GameObject val5 = CreateChild(val4, "KeyboardMesh", 19); MeshFilter val6 = val5.AddComponent<MeshFilter>(); val6.sharedMesh = KeyboardModel.KeyboardMesh; MeshRenderer val7 = val5.AddComponent<MeshRenderer>(); ((Renderer)val7).sharedMaterial = KeyboardModel.KeyboardMaterial; ((Renderer)val7).shadowCastingMode = (ShadowCastingMode)1; GameObject val8 = CreateChild(val, "Eye", 19); val8.transform.localPosition = new Vector3(0f, 0.8f, 0.1f); GameObject val9 = CreateChild(val, "Collision", 19); TrySetTag(val9, "Enemy"); BoxCollider val10 = val9.AddComponent<BoxCollider>(); ((Collider)val10).isTrigger = true; val10.center = new Vector3(0f, 0.7f, 0f); val10.size = new Vector3(1.9f, 1.1f, 0.7f); Rigidbody val11 = val9.AddComponent<Rigidbody>(); val11.isKinematic = true; val11.useGravity = false; EnemyAICollisionDetect val12 = val9.AddComponent<EnemyAICollisionDetect>(); GameObject val13 = CreateChild(val, "ScanNode", 22); TrySetTag(val13, "DoNotSet"); val13.transform.localPosition = new Vector3(0f, 0.8f, 0f); BoxCollider val14 = val13.AddComponent<BoxCollider>(); val14.size = Vector3.one; ScanNodeProperties val15 = val13.AddComponent<ScanNodeProperties>(); val15.headerText = "Evil Tim Keyboard"; val15.subText = "CLACK CLACK CLACK"; val15.nodeType = 1; val15.minRange = 1; val15.maxRange = 15; val15.requiresLineOfSight = true; val15.scrapValue = 0; val15.creatureScanID = -1; GameObject val16 = CreateChild(val, "MapDot", 14); TrySetTag(val16, "DoNotSet"); val16.transform.localPosition = new Vector3(0f, 1f, 0f); val16.AddComponent<MeshFilter>().sharedMesh = KeyboardModel.MapDotMesh; MeshRenderer val17 = val16.AddComponent<MeshRenderer>(); ((Renderer)val17).sharedMaterial = KeyboardModel.MapDotMaterial; ((Renderer)val17).shadowCastingMode = (ShadowCastingMode)0; AudioSource creatureVoice = CreateAudioSource(val, "CreatureVoice", 0.9f); AudioSource creatureSFX = CreateAudioSource(val, "CreatureSFX", 1f); EvilTimKeyboardAI evilTimKeyboardAI = val.AddComponent<EvilTimKeyboardAI>(); ((EnemyAI)evilTimKeyboardAI).agent = val2; ((EnemyAI)evilTimKeyboardAI).creatureAnimator = val3; ((EnemyAI)evilTimKeyboardAI).creatureVoice = creatureVoice; ((EnemyAI)evilTimKeyboardAI).creatureSFX = creatureSFX; ((EnemyAI)evilTimKeyboardAI).eye = val8.transform; evilTimKeyboardAI.modelRoot = val4.transform; evilTimKeyboardAI.keyboardRenderer = val7; evilTimKeyboardAI.mapDotRenderer = val17; ((EnemyAI)evilTimKeyboardAI).skinnedMeshRenderers = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[0]; ((EnemyAI)evilTimKeyboardAI).meshRenderers = (MeshRenderer[])(object)new MeshRenderer[2] { val7, val17 }; ((EnemyAI)evilTimKeyboardAI).AIIntervalTime = 0.1f; ((EnemyAI)evilTimKeyboardAI).updatePositionThreshold = 0.25f; ((EnemyAI)evilTimKeyboardAI).syncMovementSpeed = 0.22f; ((EnemyAI)evilTimKeyboardAI).exitVentAnimationTime = 0f; ((EnemyAI)evilTimKeyboardAI).enemyHP = 4; ((EnemyAI)evilTimKeyboardAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[4] { new EnemyBehaviourState { name = "Wandering", parameterString = string.Empty }, new EnemyBehaviourState { name = "Chasing", parameterString = string.Empty }, new EnemyBehaviourState { name = "Attacking", parameterString = string.Empty }, new EnemyBehaviourState { name = "Searching", parameterString = string.Empty } }; ((EnemyAI)evilTimKeyboardAI).dieSFX = AudioLibrary.Attack; val12.mainScript = (EnemyAI)(object)evilTimKeyboardAI; return val; } public static EnemyType CreateEnemyType(GameObject prefab, PluginConfig config) { //IL_003e: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) EnemyType val = ScriptableObject.CreateInstance<EnemyType>(); ((Object)val).name = "EvilTimKeyboard"; ((Object)val).hideFlags = (HideFlags)61; val.enemyName = "EvilTimKeyboard"; val.enemyPrefab = prefab; val.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) }); val.numberSpawnedFalloff = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) }); val.useNumberSpawnedFalloff = false; val.spawningDisabled = false; val.spawnFromWeeds = false; val.spawnInGroupsOf = 1; val.requireNestObjectsToSpawn = false; val.increasedChanceInterior = -1; val.PowerLevel = 1f; val.MaxCount = (config.EnemyEnabled.Value ? Mathf.Max(0, config.MaxSpawnCount.Value) : 0); val.isOutsideEnemy = false; val.isDaytimeEnemy = false; val.normalizedTimeInDayToLeave = 1f; val.stunTimeMultiplier = 1f; val.stunGameDifficultyMultiplier = 0f; val.doorSpeedMultiplier = 0.4f; val.canBeStunned = true; val.canDie = true; val.canBeDestroyed = true; val.destroyOnDeath = false; val.canSeeThroughFog = false; val.disableAnimatorWhenFar = false; val.pushPlayerForce = 0f; val.pushPlayerDistance = 0f; val.SizeLimit = (NavSizeLimit)0; val.EnemySize = (EnemySize)2; val.WaterType = (EnemyWaterType)0; val.timeToPlayAudio = 0f; val.loudnessMultiplier = 1f; val.hitBodySFX = AudioLibrary.Clacks[1]; val.hitEnemyVoiceSFX = AudioLibrary.Clacks[1]; val.deathSFX = AudioLibrary.Attack; val.stunSFX = AudioLibrary.Clacks[0]; val.miscAnimations = (MiscAnimation[])(object)new MiscAnimation[0]; val.audioClips = (AudioClip[])(object)new AudioClip[0]; ((EnemyAI)prefab.GetComponent<EvilTimKeyboardAI>()).enemyType = val; return val; } public static TerminalNode CreateBestiaryNode() { TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val).name = "EvilTimKeyboardFile"; ((Object)val).hideFlags = (HideFlags)61; val.creatureName = "Evil Tim Keyboard"; val.creatureFileID = -1; val.clearPreviousText = true; val.maxCharactersToType = 35; val.displayText = "EVIL TIM KEYBOARD\n\nSigurd's danger level: 15%\n\nScientific name: Claviatura malevola\n\nA two-metre office keyboard that drifts around the facility a hand's width above the floor, clacking to itself every few seconds. It is slow and it can only see a few steps ahead of its own keys, so it is easy to walk away from - but if it spots you it starts hammering furiously and gives chase.\n\nUp close it leans back and whips its whole body into you. It barely hurts but it WILL send you flying, so do not let it corner you next to a pit. Break line of sight for about ten seconds and it calms down.\n\nWho is Tim? we dont ask - Sigurd\n\n"; return val; } private static GameObject CreateChild(GameObject parent, string name, int layer) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown GameObject val = new GameObject(name) { layer = layer, hideFlags = (HideFlags)61 }; val.transform.SetParent(parent.transform, false); return val; } private static AudioSource CreateAudioSource(GameObject parent, string name, float volume) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateChild(parent, name, 19); val.transform.localPosition = new Vector3(0f, 0.8f, 0f); AudioSource val2 = val.AddComponent<AudioSource>(); val2.playOnAwake = false; val2.loop = false; val2.volume = volume; val2.spatialBlend = 1f; val2.rolloffMode = (AudioRolloffMode)1; val2.minDistance = 3f; val2.maxDistance = 24f; val2.dopplerLevel = 0.4f; val2.spread = 30f; return val2; } private static void TrySetTag(GameObject gameObject, string tag) { try { gameObject.tag = tag; } catch (Exception) { Plugin.Log.LogWarning((object)("Tag '" + tag + "' is not defined in this game version - '" + ((Object)gameObject).name + "' stays untagged.")); } } } public class EvilTimKeyboardAI : EnemyAI { public enum KeyboardState { Wandering, Chasing, Attacking, Searching } public const float WindUpTime = 0.35f; public const float SwingTime = 0.2f; public const float RecoveryTime = 0.45f; public const float AttackDuration = 1f; private const float ImpactWindowStart = 0.43f; private const float ImpactWindowEnd = 0.55f; public const int MaxHealth = 4; private const float FallbackPlayerWalkSpeed = 4.6f; private const float ChaseStoppingDistance = 1.2f; private const float HitRangeTolerance = 0.35f; private const float HitHalfAngle = 70f; private const float MaxHitHeightDifference = 2.2f; private const float SearchRadius = 5f; private const float GroundReleaseBoost = 7.5f; public Transform modelRoot; public MeshRenderer keyboardRenderer; public MeshRenderer mapDotRenderer; private HostSettings settings; private bool serverInitialized; private float wanderSpeed; private float chaseSpeed; private AISearchRoutine wanderRoutine; private float lastSeenTime; private Vector3 lastKnownPosition; private float nextSearchPointTime; private float nextClackTime; private int lastClackIndex = -1; private float attackTimer; private bool impactResolved; private float nextAttackAllowedTime; private readonly HashSet<int> playersHitThisSwing = new HashSet<int>(); private bool instancePrepared; private float hoverHeight = 0.3f; private bool hostSettingsReceived; private bool whipAnimationPlaying; private float whipAnimationTime; private float aggressionBlend; private float deathBlend; private float noiseSeed; private bool angryLoopOn; private bool wasAggressive; private MaterialPropertyBlock propertyBlock; private float appliedTint = -1f; public KeyboardState CurrentState => (KeyboardState)Mathf.Clamp(base.currentBehaviourStateIndex, 0, 3); private Vector3 EyePosition { get { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.eye != (Object)null)) { return ((Component)this).transform.position + Vector3.up * 0.8f; } return base.eye.position; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); PrepareInstance(); } public override void Start() { PrepareInstance(); ((EnemyAI)this).Start(); if (!hostSettingsReceived) { hoverHeight = Plugin.Cfg.HoverHeight.Value; } noiseSeed = Random.value * 100f; if (base.enemyBehaviourStates != null && base.currentBehaviourStateIndex >= 0 && base.currentBehaviourStateIndex < base.enemyBehaviourStates.Length) { base.currentBehaviourState = base.enemyBehaviourStates[base.currentBehaviourStateIndex]; } if (((NetworkBehaviour)this).IsSpawned && ((NetworkBehaviour)this).IsServer) { ServerInitialize(); } } public override void Update() { ((EnemyAI)this).Update(); float deltaTime = Time.deltaTime; UpdateAudio(); UpdateVisual(deltaTime); if (base.isEnemyDead || !((NetworkBehaviour)this).IsSpawned || !((NetworkBehaviour)this).IsServer) { return; } if (!serverInitialized) { ServerInitialize(); } if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayersDead) { return; } if (base.stunNormalizedTimer > 0f) { if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled) { base.agent.speed = 0f; } if (CurrentState == KeyboardState.Attacking) { EndAttack(interrupted: true); } return; } ServerClackTick(); switch (CurrentState) { case KeyboardState.Attacking: ServerAttackTick(deltaTime); break; case KeyboardState.Chasing: ServerFaceTargetWhenClose(deltaTime); break; } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!((NetworkBehaviour)this).IsServer || !serverInitialized || base.isEnemyDead || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayersDead || base.stunNormalizedTimer > 0f) { return; } switch (CurrentState) { case KeyboardState.Wandering: TickWandering(); break; case KeyboardState.Chasing: TickChasing(); break; case KeyboardState.Attacking: { PlayerControllerB val = FindClosestVisiblePlayer(); if ((Object)(object)val != (Object)null) { RememberSighting(val); } break; } case KeyboardState.Searching: TickSearching(); break; } } 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 && base.enemyHP <= 0) { ((EnemyAI)this).KillEnemyOnOwnerClient(false); } else if (((NetworkBehaviour)this).IsServer && serverInitialized && (Object)(object)playerWhoHit != (Object)null && IsEligible(playerWhoHit) && (CurrentState == KeyboardState.Wandering || CurrentState == KeyboardState.Searching)) { Plugin.Debug("Hit by " + playerWhoHit.playerUsername + " - investigating."); RememberSighting(playerWhoHit); if (CurrentState == KeyboardState.Wandering) { StopWanderSearch(); } BeginSearching(); } } public override void KillEnemy(bool destroy = false) { SetAngryLoop(on: false); if ((Object)(object)base.creatureSFX != (Object)null) { base.creatureSFX.Stop(); } whipAnimationPlaying = false; if (((NetworkBehaviour)this).IsServer) { StopWanderSearch(); base.movingTowardsTargetPlayer = false; base.moveTowardsDestination = false; } ((EnemyAI)this).KillEnemy(destroy); Plugin.Debug("Keyboard destroyed."); } private void PrepareInstance() { //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown if (instancePrepared) { return; } instancePrepared = true; try { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { ((Object)((Component)val).gameObject).hideFlags = (HideFlags)0; } if ((Object)(object)modelRoot == (Object)null) { modelRoot = ((Component)this).transform.Find("ModelRoot"); } if ((Object)(object)keyboardRenderer == (Object)null && (Object)(object)modelRoot != (Object)null) { keyboardRenderer = ((Component)modelRoot).GetComponentInChildren<MeshRenderer>(true); } if ((Object)(object)mapDotRenderer == (Object)null) { mapDotRenderer = FindChildComponent<MeshRenderer>("MapDot"); } if ((Object)(object)base.eye == (Object)null) { base.eye = ((Component)this).transform.Find("Eye"); } if ((Object)(object)base.creatureVoice == (Object)null) { base.creatureVoice = FindChildComponent<AudioSource>("CreatureVoice"); } if ((Object)(object)base.creatureSFX == (Object)null) { base.creatureSFX = FindChildComponent<AudioSource>("CreatureSFX"); } if ((Object)(object)base.agent == (Object)null) { base.agent = ((Component)this).GetComponent<NavMeshAgent>(); } if ((Object)(object)base.creatureAnimator == (Object)null) { base.creatureAnimator = ((Component)this).GetComponent<Animator>(); } if ((Object)(object)base.enemyType == (Object)null) { base.enemyType = Plugin.KeyboardEnemyType; } if ((Object)(object)base.dieSFX == (Object)null) { base.dieSFX = AudioLibrary.Attack; } EnemyAICollisionDetect componentInChildren = ((Component)this).GetComponentInChildren<EnemyAICollisionDetect>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.mainScript == (Object)null) { componentInChildren.mainScript = (EnemyAI)(object)this; } ScanNodeProperties componentInChildren2 = ((Component)this).GetComponentInChildren<ScanNodeProperties>(true); if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)Plugin.BestiaryNode != (Object)null && Plugin.BestiaryNode.creatureFileID >= 0) { componentInChildren2.creatureScanID = Plugin.BestiaryNode.creatureFileID; } if (base.enemyBehaviourStates == null || base.enemyBehaviourStates.Length < 4) { base.enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[4] { new EnemyBehaviourState { name = "Wandering", parameterString = string.Empty }, new EnemyBehaviourState { name = "Chasing", parameterString = string.Empty }, new EnemyBehaviourState { name = "Attacking", parameterString = string.Empty }, new EnemyBehaviourState { name = "Searching", parameterString = string.Empty } }; } if ((Object)(object)keyboardRenderer != (Object)null) { MeshFilter component = ((Component)keyboardRenderer).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh == (Object)null) { component.sharedMesh = KeyboardModel.KeyboardMesh; } if ((Object)(object)((Renderer)keyboardRenderer).sharedMaterial == (Object)null) { ((Renderer)keyboardRenderer).sharedMaterial = KeyboardModel.KeyboardMaterial; } } if ((Object)(object)mapDotRenderer != (Object)null) { MeshFilter component2 = ((Component)mapDotRenderer).GetComponent<MeshFilter>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2.sharedMesh == (Object)null) { component2.sharedMesh = KeyboardModel.MapDotMesh; } if ((Object)(object)((Renderer)mapDotRenderer).sharedMaterial == (Object)null) { ((Renderer)mapDotRenderer).sharedMaterial = KeyboardModel.MapDotMaterial; } } base.enemyHP = 4; propertyBlock = new MaterialPropertyBlock(); } catch (Exception arg) { Plugin.Log.LogError((object)$"Error while preparing a keyboard instance: {arg}"); } } private T FindChildComponent<T>(string childName) where T : Component { Transform val = ((Component)this).transform.Find(childName); if (!((Object)(object)val != (Object)null)) { return default(T); } return ((Component)val).GetComponent<T>(); } private void ServerInitialize() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (!serverInitialized) { serverInitialized = true; settings = HostSettings.FromConfig(Plugin.Cfg); float playerWalkSpeed = GetPlayerWalkSpeed(); wanderSpeed = playerWalkSpeed * settings.NormalSpeedMultiplier; chaseSpeed = playerWalkSpeed * settings.ChaseSpeedMultiplier; wanderRoutine = new AISearchRoutine { loopSearch = true, randomized = true }; Plugin.Debug($"Keyboard spawned at {((Component)this).transform.position}. Player walk speed {playerWalkSpeed:0.00} m/s -> " + $"wander {wanderSpeed:0.00} m/s, chase {chaseSpeed:0.00} m/s."); SyncHostSettingsClientRpc(settings.HoverHeight); BeginWandering(); } } private static float GetPlayerWalkSpeed() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null) { PlayerControllerB val = instance.localPlayerController; if ((Object)(object)val == (Object)null && instance.allPlayerScripts != null && instance.allPlayerScripts.Length != 0) { val = instance.allPlayerScripts[0]; } if ((Object)(object)val != (Object)null && val.movementSpeed > 0.5f) { return val.movementSpeed; } } } catch (Exception) { } return 4.6f; } private void BeginWandering() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) base.targetPlayer = null; base.movingTowardsTargetPlayer = false; SetAgent(wanderSpeed, 0f); ChangeState(KeyboardState.Wandering, null); ((EnemyAI)this).StartSearch(((Component)this).transform.position, wanderRoutine); nextClackTime = Time.time + Random.Range(0.5f, settings.NormalClackInterval); } private void TickWandering() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) SetAgent(wanderSpeed, 0f); if (base.currentSearch == null || !base.currentSearch.inProgress) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, wanderRoutine); } PlayerControllerB val = FindClosestVisiblePlayer(); if ((Object)(object)val != (Object)null) { Plugin.Debug("Spotted " + val.playerUsername + " - becoming aggressive."); BeginChase(val); } } private void BeginChase(PlayerControllerB player) { StopWanderSearch(); RememberSighting(player); base.moveTowardsDestination = true; ((EnemyAI)this).SetMovingTowardsTargetPlayer(player); SetAgent(chaseSpeed, 1.2f); ChangeState(KeyboardState.Chasing, player); } private void TickChasing() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) SetAgent(chaseSpeed, 1.2f); PlayerControllerB val = FindClosestVisiblePlayer(); if ((Object)(object)val == (Object)null) { Plugin.Debug("Lost sight of every player - searching around the last known position."); BeginSearching(); return; } RememberSighting(val); base.moveTowardsDestination = true; if ((Object)(object)val != (Object)(object)base.targetPlayer) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(val); ChangeState(KeyboardState.Chasing, val); } else if (!base.movingTowardsTargetPlayer) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(val); } Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; bool flag = Mathf.Abs(val2.y) <= 2.2f; val2.y = 0f; if (flag && ((Vector3)(ref val2)).magnitude <= settings.AttackRange && Time.time >= nextAttackAllowedTime) { BeginAttack(val); } } private void BeginSearching() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) base.targetPlayer = null; base.movingTowardsTargetPlayer = false; SetAgent(chaseSpeed, 0f); ((EnemyAI)this).SetDestinationToPosition(lastKnownPosition, false); nextSearchPointTime = Time.time + 4f; ChangeState(KeyboardState.Searching, null); } private void TickSearching() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) SetAgent(chaseSpeed, 0f); PlayerControllerB val = FindClosestVisiblePlayer(); if ((Object)(object)val != (Object)null) { Plugin.Debug("Found " + val.playerUsername + " again - resuming the chase."); BeginChase(val); return; } float num = Time.time - lastSeenTime; if (num >= settings.LoseSightSeconds) { Plugin.Debug($"No player seen for {num:0.0}s - calming down and wandering again."); BeginWandering(); return; } Vector3 val2 = base.destination - ((Component)this).transform.position; val2.y = 0f; if (((Vector3)(ref val2)).magnitude < 0.9f || Time.time >= nextSearchPointTime) { Vector3 randomNavMeshPositionInRadius = RoundManager.Instance.GetRandomNavMeshPositionInRadius(lastKnownPosition, 5f, default(NavMeshHit)); if (!((EnemyAI)this).SetDestinationToPosition(randomNavMeshPositionInRadius, true)) { ((EnemyAI)this).SetDestinationToPosition(lastKnownPosition, false); } nextSearchPointTime = Time.time + Random.Range(2.5f, 4f); } } private void RememberSighting(PlayerControllerB player) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) lastSeenTime = Time.time; lastKnownPosition = ((Component)player).transform.position; } private void StopWanderSearch() { try { if (base.currentSearch != null && base.currentSearch.inProgress) { ((EnemyAI)this).StopSearch(base.currentSearch, true); } } catch (Exception ex) { Plugin.Debug("StopSearch failed: " + ex.Message); } } private void SetAgent(float speed, float stoppingDistance) { if (!((Object)(object)base.agent == (Object)null) && ((Behaviour)base.agent).enabled) { base.agent.speed = speed; base.agent.stoppingDistance = stoppingDistance; } } private void ChangeState(KeyboardState state, PlayerControllerB target) { int num = (((Object)(object)target != (Object)null) ? ((int)target.playerClientId) : (-1)); if (CurrentState != state) { Plugin.Debug($"State {CurrentState} -> {state}" + (((Object)(object)target != (Object)null) ? (" (target " + target.playerUsername + ")") : string.Empty)); } ApplyState(state, num); SetStateClientRpc((int)state, num); } private void ApplyState(KeyboardState state, int targetIndex) { int num = Mathf.Clamp((int)state, 0, 3); if (base.currentBehaviourStateIndex != num) { base.previousBehaviourStateIndex = base.currentBehaviourStateIndex; base.currentBehaviourStateIndex = num; } if (base.enemyBehaviourStates != null && num < base.enemyBehaviourStates.Length) { base.currentBehaviourState = base.enemyBehaviourStates[num]; } PlayerControllerB targetPlayer = null; StartOfRound instance = StartOfRound.Instance; if (targetIndex >= 0 && (Object)(object)instance != (Object)null && instance.allPlayerScripts != null && targetIndex < instance.allPlayerScripts.Length) { targetPlayer = instance.allPlayerScripts[targetIndex]; } base.targetPlayer = targetPlayer; } private bool IsEligible(PlayerControllerB player) { if ((Object)(object)player == (Object)null || !player.isPlayerControlled || player.isPlayerDead) { return false; } return ((EnemyAI)this).PlayerIsTargetable(player, false, false, true); } private bool HasLineOfSight(Vector3 eyePosition, PlayerControllerB player) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; Vector3 val = (((Object)(object)player.gameplayCamera != (Object)null) ? ((Component)player.gameplayCamera).transform.position : (((Component)player).transform.position + Vector3.up * 1.6f)); if (!Physics.Linecast(eyePosition, val, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return true; } Vector3 val2 = ((Component)player).transform.position + Vector3.up * 1f; return !Physics.Linecast(eyePosition, val2, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } private PlayerControllerB FindClosestVisiblePlayer() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00e4: 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_00d8: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return null; } Vector3 position = ((Component)this).transform.position; Vector3 eyePosition = EyePosition; Vector3 forward = ((Component)this).transform.forward; forward.y = 0f; float num = settings.DetectionFOV * 0.5f; PlayerControllerB result = null; float num2 = float.MaxValue; for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if (!IsEligible(val)) { continue; } Vector3 val2 = ((Component)val).transform.position - position; float magnitude = ((Vector3)(ref val2)).magnitude; if (!(magnitude > settings.DetectionRange) && !(magnitude >= num2)) { Vector3 val3 = val2; val3.y = 0f; if ((!(num < 179.9f) || !(((Vector3)(ref val3)).sqrMagnitude > 0.04f) || !(Vector3.Angle(forward, val3) > num)) && HasLineOfSight(eyePosition, val)) { result = val; num2 = magnitude; } } } return result; } private void BeginAttack(PlayerControllerB target) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) attackTimer = 0f; impactResolved = false; playersHitThisSwing.Clear(); base.movingTowardsTargetPlayer = false; base.moveTowardsDestination = false; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled) { base.agent.speed = 0f; base.agent.velocity = Vector3.zero; base.agent.updateRotation = false; } Plugin.Debug("Body-whip started against " + target.playerUsername + "."); ChangeState(KeyboardState.Attacking, target); BeginWhipClientRpc(); } private void ServerAttackTick(float dt) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) attackTimer += dt; if (attackTimer < 0.35f && (Object)(object)base.targetPlayer != (Object)null) { FaceTowards(((Component)base.targetPlayer).transform.position, 540f * dt); } if (!impactResolved && attackTimer >= 0.43f) { ResolveImpact(); if (attackTimer >= 0.55f) { impactResolved = true; } } if (attackTimer >= 1f) { EndAttack(interrupted: false); } } private void ResolveImpact() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return; } Vector3 position = ((Component)this).transform.position; Vector3 eyePosition = EyePosition; Vector3 val = ((Component)this).transform.forward; val.y = 0f; val = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val)).normalized : Vector3.forward); float num = settings.AttackRange + 0.35f; for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val2 = instance.allPlayerScripts[i]; if ((Object)(object)val2 == (Object)null || !val2.isPlayerControlled || val2.isPlayerDead || playersHitThisSwing.Contains(i)) { continue; } Vector3 val3 = ((Component)val2).transform.position - position; if (!(Mathf.Abs(val3.y) > 2.2f)) { val3.y = 0f; float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude > num) && (!(magnitude > 0.3f) || !(Vector3.Angle(val, val3) > 70f)) && HasLineOfSight(eyePosition, val2)) { playersHitThisSwing.Add(i); Vector3 val4 = ((magnitude > 0.05f) ? (val3 / magnitude) : val); Vector3 val5 = val4 * settings.KnockbackForce + Vector3.up * settings.KnockbackUpwardForce; Plugin.Debug($"Body-whip hit {val2.playerUsername}: {settings.AttackDamage} damage, knockback {val5}."); WhipHitClientRpc(i, settings.AttackDamage, val5); } } } } private void EndAttack(bool interrupted) { impactResolved = true; if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled) { base.agent.updateRotation = true; } nextAttackAllowedTime = Time.time + settings.AttackCooldown; if (interrupted) { StopWhipClientRpc(); } PlayerControllerB val = FindClosestVisiblePlayer(); if ((Object)(object)val != (Object)null) { RememberSighting(val); base.moveTowardsDestination = true; ((EnemyAI)this).SetMovingTowardsTargetPlayer(val); SetAgent(interrupted ? 0f : chaseSpeed, 1.2f); ChangeState(KeyboardState.Chasing, val); } else { BeginSearching(); } } private void ServerFaceTargetWhenClose(float dt) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null)) { Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position; val.y = 0f; float num = settings.AttackRange + 0.5f; if (((Vector3)(ref val)).sqrMagnitude < num * num) { FaceTowards(((Component)base.targetPlayer).transform.position, 200f * dt); } } } private void FaceTowards(Vector3 worldPosition, float maxDegrees) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Vector3 val = worldPosition - ((Component)this).transform.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val2, maxDegrees); } } private void ServerClackTick() { if (CurrentState != KeyboardState.Wandering || Time.time < nextClackTime) { return; } nextClackTime = Time.time + settings.NormalClackInterval * Random.Range(0.9f, 1.1f); int num = 0; for (int i = 0; i < AudioLibrary.Clacks.Length; i++) { if ((Object)(object)AudioLibrary.Clacks[i] != (Object)null) { num++; } } if (num != 0) { int num2 = 0; int num3; do { num3 = Random.Range(0, AudioLibrary.Clacks.Length); num2++; } while (num2 < 16 && ((Object)(object)AudioLibrary.Clacks[num3] == (Object)null || (num > 1 && num3 == lastClackIndex))); if (!((Object)(object)AudioLibrary.Clacks[num3] == (Object)null)) { lastClackIndex = num3; PlayClackClientRpc(num3); } } } [ClientRpc] public void SyncHostSettingsClientRpc(float hostHoverHeight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(929024199u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref hostHoverHeight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 929024199u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; hostSettingsReceived = true; hoverHeight = Mathf.Clamp(hostHoverHeight, 0f, 3f); } } } [ClientRpc] public void SetStateClientRpc(int state, int targetPlayerIndex) { //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(1354762221u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, state); BytePacker.WriteValueBitPacked(val, targetPlayerIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1354762221u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ApplyState((KeyboardState)Mathf.Clamp(state, 0, 3), targetPlayerIndex); } } } [ClientRpc] public void PlayClackClientRpc(int clipIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(857726748u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 857726748u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!base.isEnemyDead && CurrentState == KeyboardState.Wandering && !((Object)(object)base.creatureSFX == (Object)null) && clipIndex >= 0 && clipIndex < AudioLibrary.Clacks.Length) { AudioClip val3 = AudioLibrary.Clacks[clipIndex]; if ((Object)(object)val3 != (Object)null) { base.creatureSFX.PlayOneShot(val3); } } } [ClientRpc] public void BeginWhipClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(878021612u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 878021612u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!base.isEnemyDead) { whipAnimationPlaying = true; whipAnimationTime = 0f; if ((Object)(object)base.creatureSFX != (Object)null && (Object)(object)AudioLibrary.Attack != (Object)null) { base.creatureSFX.PlayOneShot(AudioLibrary.Attack); } } } [ClientRpc] public void StopWhipClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2222340280u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2222340280u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; whipAnimationPlaying = false; } } } [ClientRpc] public void WhipHitClientRpc(int playerIndex, int damage, Vector3 knockback) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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(615236032u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerIndex); BytePacker.WriteValueBitPacked(val, damage); ((FastBufferWriter)(ref val)).WriteValueSafe(ref knockback); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 615236032u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null || playerIndex < 0 || playerIndex >= instance.allPlayerScripts.Length) { return; } PlayerControllerB val3 = instance.allPlayerScripts[playerIndex]; PlayerControllerB val4 = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 != (Object)(object)val4) && !val3.isPlayerDead && val3.isPlayerControlled) { Plugin.Debug($"Struck by the keyboard: {damage} damage, knockback {knockback}. Health before: {val3.health}."); if (damage > 0) { val3.DamagePlayer(damage, true, true, (CauseOfDeath)1, 0, false, knockback); } if (!val3.isPlayerDead) { ApplyKnockback(val3, knockback); } } } private static void ApplyKnockback(PlayerControllerB player, Vector3 knockback) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref knockback)).sqrMagnitude < 0.0001f) { return; } Vector3 val = knockback; if (val.y > 0.01f) { CharacterController component = ((Component)player).GetComponent<CharacterController>(); if ((Object)(object)component != (Object)null && component.isGrounded) { val.y += 7.5f; } } player.externalForceAutoFade += val; } private void UpdateAudio() { bool flag = !base.isEnemyDead && CurrentState != KeyboardState.Wandering; if (flag && !wasAggressive && (Object)(object)base.creatureSFX != (Object)null) { base.creatureSFX.Stop(); } wasAggressive = flag; SetAngryLoop(flag); } private void SetAngryLoop(bool on) { if ((Object)(object)base.creatureVoice == (Object)null) { return; } if (on) { if (!angryLoopOn || !base.creatureVoice.isPlaying) { AudioClip angry = AudioLibrary.Angry; if (!((Object)(object)angry == (Object)null)) { angryLoopOn = true; base.creatureVoice.clip = angry; base.creatureVoice.loop = true; base.creatureVoice.Play(); } } } else if (angryLoopOn) { angryLoopOn = false; base.creatureVoice.Stop(); base.creatureVoice.loop = false; base.creatureVoice.clip = null; } } private void UpdateVisual(float dt) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)modelRoot == (Object)null) { return; } bool flag = !base.isEnemyDead && CurrentState != KeyboardState.Wandering; aggressionBlend = Mathf.MoveTowards(aggressionBlend, flag ? 1f : 0f, dt * 3.5f); UpdateTint(); float num = 0.02f; if (base.isEnemyDead) { deathBlend = Mathf.MoveTowards(deathBlend, 1f, dt * 2.2f); float num2 = deathBlend * deathBlend; modelRoot.localPosition = new Vector3(0f, Mathf.Lerp(Mathf.Max(hoverHeight, num), 0.1f, num2), Mathf.Lerp(0f, KeyboardModel.Height * 0.5f, num2)); modelRoot.localRotation = Quaternion.Euler(Mathf.Lerp(-14f, -90f, num2), 0f, 0f); return; } float num3 = Time.time + noiseSeed; float num4 = Mathf.Sin(num3 * Mathf.Lerp(1.7f, 6.5f, aggressionBlend)) * Mathf.Lerp(0.045f, 0.03f, aggressionBlend); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, hoverHeight + num4, 0f); float num5 = -14f + aggressionBlend * 12f + Mathf.Sin(num3 * 0.8f) * 1.5f; float num6 = Mathf.Sin(num3 * 0.55f) * 3f * (1f - aggressionBlend); float num7 = Mathf.Sin(num3 * 1.1f) * 2.5f; float num8 = aggressionBlend * (whipAnimationPlaying ? 0.35f : 1f); if (num8 > 0.001f) { float num9 = num3 * 17f; num5 += (Mathf.PerlinNoise(num9, 0.3f) - 0.5f) * 14f * num8; num6 += (Mathf.PerlinNoise(0.7f, num9) - 0.5f) * 12f * num8; num7 += (Mathf.PerlinNoise(num9, num9 * 0.37f + 5f) - 0.5f) * 18f * num8; val.x += (Mathf.PerlinNoise(num9 * 1.3f, 9.1f) - 0.5f) * 0.06f * num8; val.y += (Mathf.PerlinNoise(3.3f, num9 * 1.1f) - 0.5f) * 0.06f * num8; } if (whipAnimationPlaying) { whipAnimationTime += dt; float num10 = whipAnimationTime; if (num10 < 0.35f) { float num11 = 1f - Mathf.Pow(1f - num10 / 0.35f, 3f); num5 += Mathf.Lerp(0f, -44f, num11); val.z += Mathf.Lerp(0f, -0.3f, num11); val.y += Mathf.Lerp(0f, 0.2f, num11); } else if (num10 < 0.55f) { float num12 = (num10 - 0.35f) / 0.2f; num12 *= num12; num5 += Mathf.Lerp(-44f, 86f, num12); val.z += Mathf.Lerp(-0.3f, 1.4f, num12); val.y += Mathf.Lerp(0.2f, -0.06f, num12); } else if (num10 < 1f) { float num13 = Mathf.SmoothStep(0f, 1f, (num10 - 0.35f - 0.2f) / 0.45f); num5 += Mathf.Lerp(86f, 0f, num13); val.z += Mathf.Lerp(1.4f, 0f, num13); val.y += Mathf.Lerp(-0.06f, 0f, num13); num7 += Mathf.Sin(num13 * MathF.PI * 3f) * (1f - num13) * 7f; } else { whipAnimationPlaying = false; } } if (val.y < num) { val.y = num; } modelRoot.localPosition = val; modelRoot.localRotation = Quaternion.Euler(num5, num6, num7); } private void UpdateTint() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)keyboardRenderer == (Object)null) && propertyBlock != null && !(Mathf.Abs(aggressionBlend - appliedTint) < 0.01f)) { appliedTint = aggressionBlend; Color val = Color.Lerp(Color.white, new Color(1f, 0.52f, 0.48f, 1f), aggressionBlend); ((Renderer)keyboardRenderer).GetPropertyBlock(propertyBlock); propertyBlock.SetColor(KeyboardModel.BaseColorId, val); ((Renderer)keyboardRenderer).SetPropertyBlock(propertyBlock); } } 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 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(929024199u, new RpcReceiveHandler(__rpc_handler_929024199), "SyncHostSettingsClientRpc"); ((NetworkBehaviour)this).__registerRpc(1354762221u, new RpcReceiveHandler(__rpc_handler_1354762221), "SetStateClientRpc"); ((NetworkBehaviour)this).__registerRpc(857726748u, new RpcReceiveHandler(__rpc_handler_857726748), "PlayClackClientRpc"); ((NetworkBehaviour)this).__registerRpc(878021612u, new RpcReceiveHandler(__rpc_handler_878021612), "BeginWhipClientRpc"); ((NetworkBehaviour)this).__registerRpc(2222340280u, new RpcReceiveHandler(__rpc_handler_2222340280), "StopWhipClientRpc"); ((NetworkBehaviour)this).__registerRpc(615236032u, new RpcReceiveHandler(__rpc_handler_615236032), "WhipHitClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_929024199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float hostHoverHeight = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref hostHoverHeight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilTimKeyboardAI)(object)target).SyncHostSettingsClientRpc(hostHoverHeight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1354762221(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 state = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref state); int targetPlayerIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilTimKeyboardAI)(object)target).SetStateClientRpc(state, targetPlayerIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_857726748(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 clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilTimKeyboardAI)(object)target).PlayClackClientRpc(clipIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_878021612(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilTimKeyboardAI)(object)target).BeginWhipClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2222340280(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilTimKeyboardAI)(object)target).StopWhipClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_615236032(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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerIndex); int damage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damage); Vector3 knockback = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref knockback); target.__rpc_exec_stage = (__RpcExecStage)1; ((EvilTimKeyboardAI)(object)target).WhipHitClientRpc(playerIndex, damage, knockback); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "EvilTimKeyboardAI"; } } internal enum KeyStyle { Alpha, Modifier, Accent } internal struct KeyDef { public string Label; public float X; public float Y; public float Width; public KeyStyle Style; public KeyDef(string label, float x, float y, float width, KeyStyle style) { Label = label; X = x; Y = y; Width = width; Style = style; } } internal static class KeyboardLayout { public const float UnitsWide = 18.25f; public const float UnitsHigh = 6.5f; public const char ArrowUp = '↑'; public const char ArrowDown = '↓'; public const char ArrowLeft = '←'; public const char ArrowRight = '→'; private static List<KeyDef> _keys; public static IReadOnlyList<KeyDef> Keys { get { if (_keys == null) { _keys = Build(); } return _keys; } } private static List<KeyDef> Build() { List<KeyDef> list = new List<KeyDef>(90); list.Add(new KeyDef("ESC", 0f, 0f, 1f, KeyStyle.Accent)); float num = 2f; for (int i = 1; i <= 12; i++) { list.Add(new KeyDef("F" + i, num, 0f, 1f, KeyStyle.Modifier)); num += 1f; if (i == 4 || i == 8) { num += 0.5f; } } AddRun(list, 15.25f, 0f, KeyStyle.Modifier, "PRT", "SCR", "PAU"); float y = 1.5f; num = AddRun(list, 0f, y, KeyStyle.Alpha, "`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "="); list.Add(new KeyDef("BKSP", num, y, 2f, KeyStyle.Modifier)); AddRun(list, 15.25f, y, KeyStyle.Modifier, "INS", "HOM", "PGU"); y = 2.5f; list.Add(new KeyDef("TAB", 0f, y, 1.5f, KeyStyle.Modifier)); num = AddRun(list, 1.5f, y, KeyStyle.Alpha, "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]"); list.Add(new KeyDef("\\", num, y, 1.5f, KeyStyle.Alpha)); AddRun(list, 15.25f, y, KeyStyle.Modifier, "DEL", "END", "PGD"); y = 3.5f; list.Add(new KeyDef("CAPS", 0f, y, 1.75f, KeyStyle.Modifier)); num = AddRun(list, 1.75f, y, KeyStyle.Alpha, "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'"); list.Add(new KeyDef("ENTER", num, y, 2.25f, KeyStyle.Accent)); y = 4.5f; list.Add(new KeyDef("SHIFT", 0f, y, 2.25f, KeyStyle.Modifier)); num = AddRun(list, 2.25f, y, KeyStyle.Alpha, "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/"); list.Add(new KeyDef("SHIFT", num, y, 2.75f, KeyStyle.Modifier)); list.Add(new KeyDef('↑'.ToString(), 16.25f, y, 1f, KeyStyle.Accent)); y = 5.5f; num = 0f; list.Add(new KeyDef("CTRL", num, y, 1.25f, KeyStyle.Modifier)); num += 1.25f; list.Add(new KeyDef("WIN", num, y, 1.25f, KeyStyle.Modifier)); num += 1.25f; list.Add(new KeyDef("ALT", num, y, 1.25f, KeyStyle.Modifier)); num += 1.25f; list.Add(new KeyDef("", num, y, 6.25f, KeyStyle.Alpha)); num += 6.25f; list.Add(new KeyDef("ALT", num, y, 1.25f, KeyStyle.Modifier)); num += 1.25f; list.Add(new KeyDef("WIN", num, y, 1.25f, KeyStyle.Modifier)); num += 1.25f; list.Add(new KeyDef("FN", num, y, 1.25f, KeyStyle.Modifier)); num += 1.25f; list.Add(new KeyDef("CTRL", num, y, 1.25f, KeyStyle.Modifier)); AddRun(list, 15.25f, y, KeyStyle.Accent, '←'.ToString(), '↓'.ToString(), '→'.ToString()); return list; } private static float AddRun(List<KeyDef> keys, float startX, float y, KeyStyle style, params string[] labels) { float num = startX; foreach (string label in labels) { keys.Add(new KeyDef(label, num, y, 1f, style)); num += 1f; } return num; } } internal static class KeyboardModel { private sealed class MeshData { public readonly List<Vector3> Vertices = new List<Vector3>(4096); public readonly List<Vector3> Normals = new List<Vector3>(4096); public readonly List<Vector2> Uvs = new List<Vector2>(4096); public readonly List<int> Triangles = new List<int>(8192); public void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 outward, Vector2 ua, Vector2 ub, Vector2 uc, Vector2 ud) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a0: 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_00b9: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(b - a, c - a); Vector3 val2 = ((Vector3)(ref val)).normalized; bool flag = Vector3.Dot(val2, outward) >= 0f; if (!flag) { val2 = -val2; } int count = Vertices.Count; Vertices.Add(a); Vertices.Add(b); Vertices.Add(c); Vertices.Add(d); Normals.Add(val2); Normals.Add(val2); Normals.Add(val2); Normals.Add(val2); Uvs.Add(ua); Uvs.Add(ub); Uvs.Add(uc); Uvs.Add(ud); if (flag) { Triangles.Add(count); Triangles.Add(count + 1); Triangles.Add(count + 2); Triangles.Add(count); Triangles.Add(count + 2); Triangles.Add(count + 3); } else { Triangles.Add(count); Triangles.Add(count + 2); Triangles.Add(count + 1); Triangles.Add(count); Triangles.Add(count + 3); Triangles.Add(count + 2); } } public void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 outward, Vector2 uv) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0008: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Quad(a, b, c, d, outward, uv, uv, uv, uv); } public void Box(Vector3 min, Vector3 max, Vector2 uv) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) Vector3 a = default(Vector3); ((Vector3)(ref a))..ctor(min.x, min.y, min.z); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(max.x, min.y, min.z); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(min.x, max.y, min.z); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(max.x, max.y, min.z); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(min.x, min.y, max.z); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(max.x, min.y, max.z); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(min.x, max.y, max.z); Vector3 c = default(Vector3); ((Vector3)(ref c))..ctor(max.x, max.y, max.z); Quad(val4, val5, c, val6, Vector3.forward, uv); Quad(a, val, val3, val2, Vector3.back, uv); Quad(val2, val3, c, val6, Vector3.up, uv); Quad(a, val, val5, val4, Vector3.down, uv); Quad(val, val3, c, val5, Vector3.right, uv); Quad(a, val2, val6, val4, Vector3.left, uv); } public Mesh ToMesh(string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Mesh val = new Mesh { name = name, hideFlags = (HideFlags)61 }; val.SetVertices(Vertices); val.SetNormals(Normals); val.SetUVs(0, Uvs); val.SetTriangles(Triangles, 0); val.RecalculateBounds(); return val; } } public const float Width = 2f; private const float BezelUnits = 0.35f; private const float KeyGapUnits = 0.04f; private const float KeyTopInsetUnits = 0.12f; private const float KeyHeightUnits = 0.42f; public static readonly float Unit = 0.105540894f; public static readonly float Height = 7.2f * Unit; public const float Thickness = 0.09f; public static readonly float KeyHeight = 0.42f * Unit; private const int AtlasSize = 1024; private const int CellWidth = 144; private const int CellHeight = 48; private const int CellPadding = 2; private const int CellPitchX = 148; private const int CellPitchY = 52; private const int CellsPerRow = 6; private const int ChassisCell = 0; private const int BackTextCell = 1; private const int FirstSolidCell = 2; private const int FirstKeyCell = 5; private static readonly Color32 ChassisColor = new Color32((byte)26, (byte)26, (byte)30, byte.MaxValue); private static readonly Color32 BackTextColor = new Color32((byte)200, (byte)24, (byte)24, byte.MaxValue); private static readonly Color32[] CapColors = (Color32[])(object)new Color32[3] { new Color32((byte)226, (byte)222, (byte)210, byte.MaxValue), new Color32((byte)66, (byte)68, (byte)78, byte.MaxValue), new Color32((byte)186, (byte)28, (byte)28, byte.MaxValue) }; private static readonly Color32[] LegendColors = (Color32[])(object)new Color32[3] { new Color32((byte)24, (byte)24, (byte)28, byte.MaxValue), new Color32((byte)236, (byte)236, (byte)236, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) }; private static Mesh _keyboardMesh; private static Mesh _mapDotMesh; private static Texture2D _atlas; private static Material _keyboardMaterial; private static Material _mapDotMaterial; public static readonly int BaseColorId = Shader.PropertyToID("_BaseColor"); public static Mesh KeyboardMesh { get { if ((Object)(object)_keyboardMesh == (Object)null) { _keyboardMesh = BuildKeyboardMesh(); } return _keyboardMesh; } } public static Mesh MapDotMesh { get { if ((Object)(object)_mapDotMesh == (Object)null) { _mapDotMesh = BuildMapDotMesh(); } return _mapDotMesh; } } public static Texture2D Atlas { get { if ((Object)(object)_atlas == (Object)null) { _atlas = BuildAtlas(); } return _atlas; } } public static Material KeyboardMaterial { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_keyboardMaterial == (Object)null) { _keyboardMaterial = CreateMaterial("EvilTimKeyboard_Mat", Color.white, Atlas, 0.38f); } return _keyboardMaterial; } } public static Material MapDotMaterial { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mapDotMaterial == (Object)null) { _mapDotMaterial = CreateMaterial("EvilTimKeyboard_MapDot", new Color(1f, 0f, 0.05f, 1f), null, 0f); } return _mapDotMaterial; } } private static Shader FindLitShader() { Shader val = Shader.Find("HDRP/Lit"); if ((Object)(object)val == (Object)null) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val2 in array) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name == "HDRP/Lit") { val = val2; break; } } } if ((Object)(object)val == (Object)null) { val = Shader.Find("Standard"); } return val; } private static Material CreateMaterial(string name, Color color, Texture2D texture, float smoothness) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Shader val = FindLitShader(); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"No lit shader is available yet - the keyboard material will be created later."); return null; } Material val2 = new Material(val) { name = name, hideFlags = (HideFlags)61 }; if (val2.HasProperty(BaseColorId)) { val2.SetColor(BaseColorId, color); } if (val2.HasProperty("_Color")) { val2.SetColor("_Color", color); } if ((Object)(object)texture != (Object)null) { if (val2.HasProperty("_BaseColorMap")) { val2.SetTexture("_BaseColorMap", (Texture)(object)texture); } if (val2.HasProperty("_MainTex")) { val2.SetTexture("_MainTex", (Texture)(object)texture); } } if (val2.HasProperty("_Smoothness")) { val2.SetFloat("_Smoothness", smoothness); } if (val2.HasProperty("_Metallic")) { val2.SetFloat("_Metallic", 0f); } if (val2.HasProperty("_Glossiness")) { val2.SetFloat("_Glossiness", smoothness); } return val2; } private static void CellOrigin(int cell, out int x, out int y) { x = cell % 6 * 148 + 2; y = cell / 6 * 52 + 2; } private static Rect CellUv(int cell, float widthPx) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) CellOrigin(cell, out var x, out var y); widthPx = Mathf.Clamp(widthPx, 4f, 144f); float num = (float)x + (144f - widthPx) * 0.5f; float num2 = (num + 0.5f) / 1024f; float num3 = (num + widthPx - 0.5f) / 1024f; float num4 = 1f - ((float)y + 0.5f) / 1024f; float num5 = 1f - ((float)(y + 48) - 0.5f) / 1024f; return Rect.MinMaxRect(num2, num5, num3, num4); } private static Vector2 CellCenterUv(int cell) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) CellOrigin(cell, out var x, out var y); return new Vector2(((float)x + 72f) / 1024f, 1f - ((float)y + 24f) / 1024f); } private static float TopFacePixelWidth(KeyDef key) { float num = key.Width - 0.32f; float num2 = 0.68f; return Mathf.Clamp(48f * (num / num2), 48f, 144f); } private static void FillCell(Color32[] pixels, int cell, Color32 color) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) CellOrigin(cell, out var x, out var y); PixelFont.FillRect(pixels, 1024, 1024, x - 2, y - 2, 148, 52, color); } private static void DrawCentered(Color32[] pixels, int cell, string text, int scale, Color32 color) { //IL_003f: Unknown result type (might be due to invalid IL or missing references)