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 LethalCannibal v1.0.0
LethalCannibal.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 LethalCannibal { [BepInPlugin("com.lethalcanni.cannibal", "LethalCannibal", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.lethalcanni.cannibal"; public const string Name = "LethalCannibal"; public const string Version = "1.0.0"; internal const float EatDuration = 4f; internal const float EatRange = 3.2f; internal const int FullHealth = 100; internal const string TipLine = "Eat body : [F]"; internal static ManualLogSource Log; private static AudioClip eatClip; internal static AudioClip EatClip { get { if ((Object)(object)eatClip != (Object)null) { return eatClip; } try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LethalCannibal.eat.pcm"); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); float[] array2 = new float[array.Length / 2]; for (int i = 0; i < array2.Length; i++) { array2[i] = (float)(short)(array[i * 2] | (array[i * 2 + 1] << 8)) / 32768f; } eatClip = AudioClip.Create("CannibalEat", array2.Length / 2, 2, 32000, false); eatClip.SetData(array2, 0); ((Object)eatClip).hideFlags = (HideFlags)61; } catch (Exception ex) { Log.LogError((object)("Could not load the eating sound: " + ex)); } return eatClip; } } private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony harmony = new Harmony("com.lethalcanni.cannibal"); Type typeFromHandle = typeof(PlayerControllerB); Patch(harmony, typeof(StartOfRound), "Start", null, "RegisterNetwork"); Patch(harmony, typeFromHandle, "ConnectClientToPlayerObject", null, "RegisterNetwork"); Patch(harmony, typeFromHandle, "Update", null, "PlayerUpdate"); Patch(harmony, typeFromHandle, "SetHoverTipAndCurrentInteractTrigger", null, "HoverTip"); string[] array = new string[12] { "Jump_performed", "Crouch_performed", "Interact_performed", "ActivateItem_performed", "Discard_performed", "ScrollMouse_performed", "ItemSecondaryUse_performed", "ItemTertiaryUse_performed", "InspectItem_performed", "QEItemInteract_performed", "Emote1_performed", "Emote2_performed" }; foreach (string method in array) { Patch(harmony, typeFromHandle, method, "BlockWhileEating", null); } Log.LogInfo((object)"LethalCannibal 1.0.0 loaded."); } private static void Patch(Harmony harmony, Type type, string method, string prefix, string postfix) { //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) try { MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null); if (methodInfo == null) { Log.LogWarning((object)("Game method not found, skipped: " + type.Name + "." + method)); } else { harmony.Patch((MethodBase)methodInfo, (prefix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(Hooks), prefix, (Type[])null), (postfix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(Hooks), postfix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { Log.LogError((object)("Could not patch " + type.Name + "." + method + ": " + ex)); } } } internal static class Game { internal static PlayerControllerB LocalPlayer { get { GameNetworkManager instance = GameNetworkManager.Instance; if (!((Object)(object)instance != (Object)null)) { return null; } return instance.localPlayerController; } } internal static PlayerControllerB PlayerAt(int index) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return null; } if (index < 0 || index >= instance.allPlayerScripts.Length) { return null; } return instance.allPlayerScripts[index]; } internal static int IndexOf(PlayerControllerB player) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null || (Object)(object)player == (Object)null) { return -1; } for (int i = 0; i < instance.allPlayerScripts.Length; i++) { if ((Object)(object)instance.allPlayerScripts[i] == (Object)(object)player) { return i; } } return -1; } internal static bool IsEdible(DeadBodyInfo body) { if ((Object)(object)body != (Object)null && ((Component)body).gameObject.activeInHierarchy && !body.deactivated) { return (Object)(object)((Component)body).GetComponent<EatenMarker>() == (Object)null; } return false; } internal static Vector3 CorpsePosition(DeadBodyInfo body) { //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_0053: 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_004d: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; Rigidbody[] bodyParts = body.bodyParts; if (bodyParts != null) { for (int i = 0; i < bodyParts.Length; i++) { if ((Object)(object)bodyParts[i] != (Object)null) { val += ((Component)bodyParts[i]).transform.position; num++; } } } if (num <= 0) { return ((Component)body).transform.position; } return val / (float)num; } internal static bool CanStartEating(PlayerControllerB p) { if ((Object)(object)p == (Object)null || p.isPlayerDead || !p.isPlayerControlled) { return false; } if (p.inTerminalMenu || p.isTypingChat || p.inSpecialInteractAnimation || p.isClimbingLadder) { return false; } if ((Object)(object)p.inAnimationWithEnemy != (Object)null || p.inVehicleAnimation) { return false; } if ((Object)(object)p.quickMenuManager != (Object)null && p.quickMenuManager.isMenuOpen) { return false; } return !EatSession.Active.ContainsKey(IndexOf(p)); } internal static int FindVictim(PlayerControllerB me) { //IL_0045: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null || (Object)(object)me == (Object)null) { return -1; } Transform val = (((Object)(object)me.gameplayCamera != (Object)null) ? ((Component)me.gameplayCamera).transform : ((Component)me).transform); Vector3 position = val.position; int result = -1; float num = 3.2f; for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val2 = instance.allPlayerScripts[i]; if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)me) && IsEdible(val2.deadBody)) { Vector3 val3 = CorpsePosition(val2.deadBody) - position; float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude > num) && (!(magnitude > 1.9f) || !(Vector3.Angle(val.forward, val3) > 50f))) { result = i; num = magnitude; } } } return result; } } internal static class Hooks { private static float lastRequest = -10f; private static int hoverVictim = -1; public static void RegisterNetwork() { Net.Register(); } public static bool BlockWhileEating(PlayerControllerB __instance) { if (EatSession.LocalEating) { return !((Object)(object)__instance == (Object)(object)Game.LocalPlayer); } return true; } public static void PlayerUpdate(PlayerControllerB __instance) { if ((Object)(object)__instance != (Object)(object)Game.LocalPlayer) { return; } hoverVictim = -1; if (EatSession.LocalEating || !Game.CanStartEating(__instance)) { return; } hoverVictim = Game.FindVictim(__instance); if (hoverVictim >= 0) { Keyboard current = Keyboard.current; if (current != null && ((ButtonControl)current.fKey).wasPressedThisFrame && !(Time.realtimeSinceStartup - lastRequest < 0.75f)) { lastRequest = Time.realtimeSinceStartup; Net.RequestEat(Game.IndexOf(__instance), hoverVictim); } } } public static void HoverTip(PlayerControllerB __instance) { if (!((Object)(object)__instance != (Object)(object)Game.LocalPlayer) && !((Object)(object)__instance.cursorTip == (Object)null)) { string text = ((TMP_Text)__instance.cursorTip).text ?? ""; int num = text.IndexOf("Eat body : [F]", StringComparison.Ordinal); if (num >= 0) { text = text.Remove(num).TrimEnd('\n'); } if (hoverVictim >= 0 && !EatSession.LocalEating) { text = ((text.Length > 0) ? (text + "\nEat body : [F]") : "Eat body : [F]"); } if (text != ((TMP_Text)__instance.cursorTip).text) { ((TMP_Text)__instance.cursorTip).text = text; } } } } internal static class Net { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequest; public static HandleNamedMessageDelegate <1>__OnStart; } private const string RequestMsg = "LethalCannibal.Request"; private const string StartMsg = "LethalCannibal.Start"; internal static void Register() { //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_003f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown try { NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.CustomMessagingManager != null) { CustomMessagingManager customMessagingManager = singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequest; if (obj == null) { HandleNamedMessageDelegate val = OnRequest; <>O.<0>__OnRequest = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("LethalCannibal.Request", (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnStart; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnStart; <>O.<1>__OnStart = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("LethalCannibal.Start", (HandleNamedMessageDelegate)obj2); } } catch (Exception ex) { Plugin.Log.LogError((object)("Network setup failed: " + ex)); } } private static void Send(string msg, ulong client, int eater, int victim) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(2, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteByteSafe((byte)eater); ((FastBufferWriter)(ref val)).WriteByteSafe((byte)victim); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(msg, client, val, (NetworkDelivery)3); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } private static void Read(FastBufferReader r, out int eater, out int victim) { byte b = default(byte); ((FastBufferReader)(ref r)).ReadByteSafe(ref b); byte b2 = default(byte); ((FastBufferReader)(ref r)).ReadByteSafe(ref b2); eater = b; victim = b2; } internal static void RequestEat(int eater, int victim) { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || eater < 0 || victim < 0) { return; } try { if (singleton.IsServer) { Approve(eater, victim); } else { Send("LethalCannibal.Request", 0uL, eater, victim); } } catch (Exception ex) { Plugin.Log.LogError((object)("Eat request failed: " + ex)); } } private static void OnRequest(ulong sender, FastBufferReader reader) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton == (Object)null) && singleton.IsServer) { Read(reader, out var eater, out var victim); PlayerControllerB val = Game.PlayerAt(eater); if (!((Object)(object)val == (Object)null) && val.actualClientId == sender) { Approve(eater, victim); } } } private static void Approve(int eater, int victim) { PlayerControllerB val = Game.PlayerAt(eater); PlayerControllerB val2 = Game.PlayerAt(victim); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val == (Object)(object)val2 || val.isPlayerDead || !val.isPlayerControlled || !Game.IsEdible(val2.deadBody) || EatSession.Active.ContainsKey(eater)) { return; } NetworkManager singleton = NetworkManager.Singleton; foreach (ulong connectedClientsId in singleton.ConnectedClientsIds) { if (connectedClientsId != singleton.LocalClientId) { Send("LethalCannibal.Start", connectedClientsId, eater, victim); } } EatSession.Begin(eater, victim); } private static void OnStart(ulong sender, FastBufferReader reader) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Read(reader, out var eater, out var victim); EatSession.Begin(eater, victim); } } internal class EatenMarker : MonoBehaviour { } [DefaultExecutionOrder(20000)] internal class EatSession : MonoBehaviour { private class Arm { public Transform upper; public Transform lower; public Transform hand; public bool left; public bool firstPerson; } internal static readonly Dictionary<int, EatSession> Active = new Dictionary<int, EatSession>(); internal static bool LocalEating; private static readonly float[] BiteTimes = new float[4] { 0.1f, 1.05f, 2f, 2.95f }; private PlayerControllerB eater; private DeadBodyInfo body; private EatenMarker marker; private int eaterIndex; private bool isLocal; private bool wasCrouching; private bool finished; private bool cleaned; private bool prevMove; private bool prevLook; private bool prevInteract; private float t; private float crouchRetry; private int nextBite; private readonly List<Arm> arms = new List<Arm>(); private Transform spine; private Transform head; private static readonly string[] Severed = new string[5] { "spine.004", "arm.L_upper", "arm.R_lower", "shin.L", "thigh.R" }; internal static void Begin(int eaterIdx, int victimIdx) { try { PlayerControllerB val = Game.PlayerAt(eaterIdx); PlayerControllerB val2 = Game.PlayerAt(victimIdx); if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null) && !Active.ContainsKey(eaterIdx) && !val.isPlayerDead && Game.IsEdible(val2.deadBody)) { ((Component)val).gameObject.AddComponent<EatSession>().Init(val, eaterIdx, val2.deadBody); } } catch (Exception ex) { Plugin.Log.LogError((object)("Could not start eating: " + ex)); } } private void Init(PlayerControllerB e, int index, DeadBodyInfo corpse) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00bf: Unknown result type (might be due to invalid IL or missing references) eater = e; eaterIndex = index; body = corpse; marker = ((Component)corpse).gameObject.AddComponent<EatenMarker>(); isLocal = (Object)(object)e == (Object)(object)Game.LocalPlayer; Active[index] = this; FindBones(); if (isLocal) { LocalEating = true; wasCrouching = e.isCrouching; prevMove = e.disableMoveInput; prevLook = e.disableLookInput; prevInteract = e.disableInteract; Vector3 val = Game.CorpsePosition(corpse) - ((Component)e).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.04f) { ((Component)e).transform.rotation = Quaternion.LookRotation(val); } } } private void FindBones() { Transform[] componentsInChildren = ((Component)eater).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { string name = ((Object)val).name; bool flag = UnderArmsOnly(val); if (name == "arm.L_upper" || name == "arm.R_upper") { bool flag2 = name == "arm.L_upper"; Transform val2 = Child(val, flag2 ? "arm.L_lower" : "arm.R_lower"); Transform val3 = (((Object)(object)val2 != (Object)null) ? Child(val2, flag2 ? "hand.L" : "hand.R") : null); if ((Object)(object)val3 != (Object)null) { arms.Add(new Arm { upper = val, lower = val2, hand = val3, left = flag2, firstPerson = flag }); } } else if (!flag && name == "spine.002" && (Object)(object)spine == (Object)null) { spine = val; } else if (!flag && name == "spine.004" && (Object)(object)head == (Object)null) { head = val; } } } private bool UnderArmsOnly(Transform tr) { Transform val = tr; while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)((Component)eater).transform) { if (((Object)val).name.IndexOf("ArmsOnly", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } val = val.parent; } return false; } private static Transform Child(Transform parent, string name) { for (int i = 0; i < parent.childCount; i++) { if (((Object)parent.GetChild(i)).name == name) { return parent.GetChild(i); } } return null; } private void Update() { if (finished) { return; } if ((Object)(object)eater == (Object)null || eater.isPlayerDead || !eater.isPlayerControlled || (Object)(object)body == (Object)null) { End(completed: false); return; } t += Time.deltaTime; if (isLocal) { eater.disableMoveInput = true; eater.disableLookInput = true; eater.disableInteract = true; if (!eater.isCrouching && Time.time >= crouchRetry) { crouchRetry = Time.time + 0.4f; try { eater.Crouch(true); } catch (Exception) { } } } if ((Object)(object)eater.playerBodyAnimator != (Object)null) { eater.playerBodyAnimator.SetBool("crouching", true); } while (nextBite < BiteTimes.Length && t >= BiteTimes[nextBite]) { Bite(nextBite == 0); nextBite++; } if (t >= 4f) { End(completed: true); } } private void Bite(bool first) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) try { AudioClip eatClip = Plugin.EatClip; if ((Object)(object)eatClip != (Object)null && (Object)(object)eater.movementAudio != (Object)null) { eater.movementAudio.PlayOneShot(eatClip, 1f); } if ((Object)(object)body.bloodSplashParticle != (Object)null) { body.bloodSplashParticle.Play(); } if (first) { eater.AddBloodToBody(); } eater.DropBlood(Vector3.down, true, false); if (isLocal && (Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Bite effect failed: " + ex.Message)); } } private void End(bool completed) { if (finished) { return; } finished = true; if (completed) { try { Dismember(body); } catch (Exception ex) { Plugin.Log.LogError((object)("Dismember failed: " + ex)); } try { Heal(); } catch (Exception ex2) { Plugin.Log.LogError((object)("Heal failed: " + ex2)); } } else if ((Object)(object)marker != (Object)null) { Object.Destroy((Object)(object)marker); } Cleanup(); Object.Destroy((Object)(object)this); } private void Heal() { eater.health = 100; eater.bleedingHeavily = false; eater.criticallyInjured = false; eater.hasBeenCriticallyInjured = false; try { eater.MakeCriticallyInjured(false); } catch (Exception) { } if (isLocal && (Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.UpdateHealthUI(100, false); HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } private static void Dismember(DeadBodyInfo corpse) { if ((Object)(object)corpse == (Object)null) { return; } int num = 0; Transform[] componentsInChildren = ((Component)corpse).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (Array.IndexOf(Severed, ((Object)val).name) >= 0) { Sever(val); num++; } } if (num < 2 && corpse.bodyParts != null) { for (int j = 0; j < corpse.bodyParts.Length && j < 4; j++) { if ((Object)(object)corpse.bodyParts[j] != (Object)null) { Sever(((Component)corpse.bodyParts[j]).transform); } } } try { corpse.MakeCorpseBloody(); } catch (Exception) { } if ((Object)(object)corpse.bloodSplashParticle != (Object)null) { corpse.bloodSplashParticle.Play(); } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)corpse.bodyAudio != (Object)null && (Object)(object)instance != (Object)null && (Object)(object)instance.bloodGoreSFX != (Object)null) { corpse.bodyAudio.PlayOneShot(instance.bloodGoreSFX); } } private static void Sever(Transform bone) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Collider[] componentsInChildren = ((Component)bone).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } bone.localScale = Vector3.one * 0.001f; } private void Cleanup() { if (cleaned) { return; } cleaned = true; if (Active.TryGetValue(eaterIndex, out var value) && (Object)(object)value == (Object)(object)this) { Active.Remove(eaterIndex); } if ((Object)(object)eater == (Object)null) { if (isLocal) { LocalEating = false; } return; } if (isLocal) { LocalEating = false; eater.disableMoveInput = prevMove; eater.disableLookInput = prevLook; eater.disableInteract = prevInteract; if (!wasCrouching && eater.isCrouching && !eater.isPlayerDead) { try { eater.Crouch(false); } catch (Exception) { } } } if ((Object)(object)eater.playerBodyAnimator != (Object)null) { eater.playerBodyAnimator.SetBool("crouching", eater.isCrouching); } } private void OnDestroy() { if (!finished && (Object)(object)marker != (Object)null) { Object.Destroy((Object)(object)marker); } Cleanup(); } private void LateUpdate() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: 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_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //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_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: 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_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) if (finished || (Object)(object)eater == (Object)null) { return; } float num = Mathf.Clamp01(t / 0.2f) * Mathf.Clamp01((4f - t) / 0.25f); if (num <= 0f) { return; } Transform transform = ((Component)eater).transform; Vector3 forward = transform.forward; Vector3 right = transform.right; Vector3 up = Vector3.up; if ((Object)(object)spine != (Object)null) { spine.rotation = Quaternion.AngleAxis(num * (24f + 7f * Mathf.Sin(t * 21f)), right) * spine.rotation; } if ((Object)(object)head != (Object)null) { head.rotation = Quaternion.AngleAxis(num * 20f * Mathf.Sin(t * 33f), right) * Quaternion.AngleAxis(num * 14f * Mathf.Sin(t * 25f + 1f), up) * head.rotation; } Vector3 val = (((Object)(object)head != (Object)null) ? (head.position + up * 0.12f + forward * 0.14f) : (transform.position + up * 0.95f + forward * 0.2f)); Vector3 val2 = transform.position + forward * 0.5f + up * 0.2f; Transform val3 = (((Object)(object)eater.gameplayCamera != (Object)null) ? ((Component)eater.gameplayCamera).transform : null); foreach (Arm arm in arms) { if (!((Object)(object)arm.upper == (Object)null) && !((Object)(object)arm.lower == (Object)null) && !((Object)(object)arm.hand == (Object)null) && (!arm.firstPerson || (isLocal && !((Object)(object)val3 == (Object)null)))) { float num2 = (arm.left ? (-1f) : 1f); float num3 = Mathf.Repeat(t * 2.7f + (arm.left ? 0f : 0.5f), 1f); float num4 = 0.5f - 0.5f * Mathf.Cos(num3 * MathF.PI * 2f); Vector3 val4 = new Vector3(Mathf.Sin(t * 41f + num2), Mathf.Sin(t * 37f + 2f * num2), Mathf.Sin(t * 29f)) * 0.025f; Vector3 val5; Vector3 val6; Vector3 hint; if (arm.firstPerson) { val5 = val3.position + val3.forward * 0.24f - val3.up * 0.17f + val3.right * (0.08f * num2); val6 = val3.position + val3.forward * 0.5f - val3.up * 0.6f + val3.right * (0.16f * num2); hint = val3.right * num2 - val3.up * 0.8f; } else { val5 = val + right * (0.07f * num2); val6 = val2 + right * (0.16f * num2); hint = right * num2 - up * 0.6f; } SolveArm(arm, Vector3.Lerp(val5, val6, num4) + val4, hint, num); } } } private static void SolveArm(Arm arm, Vector3 target, Vector3 hint, float weight) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0051: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00cc: 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) //IL_0110: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) Transform upper = arm.upper; Transform lower = arm.lower; Transform hand = arm.hand; Quaternion rotation = upper.rotation; Quaternion localRotation = lower.localRotation; Vector3 val = lower.position - upper.position; float magnitude = ((Vector3)(ref val)).magnitude; val = hand.position - lower.position; float magnitude2 = ((Vector3)(ref val)).magnitude; if (!(magnitude < 0.001f) && !(magnitude2 < 0.001f)) { Vector3 val2 = target - upper.position; float num = Mathf.Clamp(((Vector3)(ref val2)).magnitude, Mathf.Abs(magnitude - magnitude2) + 0.01f, (magnitude + magnitude2) * 0.995f); Vector3 val3 = upper.position - lower.position; Vector3 val4 = hand.position - lower.position; float num2 = Vector3.Angle(val3, val4); float num3 = Mathf.Acos(Mathf.Clamp((magnitude * magnitude + magnitude2 * magnitude2 - num * num) / (2f * magnitude * magnitude2), -1f, 1f)) * 57.29578f; Vector3 val5 = Vector3.Cross(val3, val4); if (((Vector3)(ref val5)).sqrMagnitude < 1E-08f) { val5 = Vector3.Cross(val3, hint); } if (((Vector3)(ref val5)).sqrMagnitude < 1E-08f) { val5 = Vector3.up; } lower.rotation = Quaternion.AngleAxis(num3 - num2, ((Vector3)(ref val5)).normalized) * lower.rotation; upper.rotation = Quaternion.FromToRotation(hand.position - upper.position, val2) * upper.rotation; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val6 = Vector3.ProjectOnPlane(lower.position - upper.position, normalized); Vector3 val7 = Vector3.ProjectOnPlane(hint, normalized); if (((Vector3)(ref val6)).sqrMagnitude > 1E-06f && ((Vector3)(ref val7)).sqrMagnitude > 1E-06f) { upper.rotation = Quaternion.AngleAxis(Vector3.SignedAngle(val6, val7, normalized), normalized) * upper.rotation; } if (weight < 0.999f) { Quaternion localRotation2 = lower.localRotation; upper.rotation = Quaternion.Slerp(rotation, upper.rotation, weight); lower.localRotation = Quaternion.Slerp(localRotation, localRotation2, weight); } } } } }