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 Higgs Guitar v1.1.0
BepInEx/plugins/HiggsGuitar.dll
Decompiled a day 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.InteropServices; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; using UnityEngine.LowLevel; using UnityEngine.PlayerLoop; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyTitle("HiggsGuitar")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("1.1.0.0")] namespace HiggsGuitar; internal static class GuitarAssets { private const string ModelFile = "guitar_model.bin"; private const int PropsLayer = 6; private const int ScanNodeLayer = 22; internal static string Directory; internal static Mesh Mesh; internal static Bounds Bounds; internal static Material Material; internal static AudioClip[] BlastClips = (AudioClip[])(object)new AudioClip[0]; internal static Item Item; internal static GameObject Prefab; internal static float RestHeight; internal static Vector3 Muzzle; private static bool finished; private static int attempts; internal static void LoadMesh() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0105: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) string text = Find("guitar_model.bin"); if (text == null) { throw new FileNotFoundException("guitar_model.bin not found under " + Directory); } Vector3[] array4; Vector3[] array5; Vector2[] array6; int[] array8; using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(text))) { if (new string(binaryReader.ReadChars(4)) != "HGGT" || binaryReader.ReadUInt32() != 1) { throw new InvalidDataException("unexpected model file header"); } int num = (int)binaryReader.ReadUInt32(); int num2 = (int)binaryReader.ReadUInt32(); float[] array = ReadFloats(binaryReader, num * 3); float[] array2 = ReadFloats(binaryReader, num * 3); float[] array3 = ReadFloats(binaryReader, num * 2); array4 = (Vector3[])(object)new Vector3[num]; array5 = (Vector3[])(object)new Vector3[num]; array6 = (Vector2[])(object)new Vector2[num]; for (int i = 0; i < num; i++) { ref Vector3 reference = ref array4[i]; reference = new Vector3(array[i * 3], array[i * 3 + 1], array[i * 3 + 2]); ref Vector3 reference2 = ref array5[i]; reference2 = new Vector3(array2[i * 3], array2[i * 3 + 1], array2[i * 3 + 2]); ref Vector2 reference3 = ref array6[i]; reference3 = new Vector2(array3[i * 2], array3[i * 2 + 1]); } byte[] array7 = binaryReader.ReadBytes(num2 * 4); if (array7.Length != num2 * 4) { throw new EndOfStreamException("model file is truncated"); } array8 = new int[num2]; Buffer.BlockCopy(array7, 0, array8, 0, array7.Length); } Mesh = new Mesh(); ((Object)Mesh).name = "HiggsGuitar"; ((Object)Mesh).hideFlags = (HideFlags)61; Mesh.indexFormat = (IndexFormat)(array4.Length > 65000); Mesh.vertices = array4; Mesh.normals = array5; Mesh.uv = array6; Mesh.triangles = array8; Mesh.RecalculateBounds(); Mesh.RecalculateTangents(); Bounds = Mesh.bounds; RestHeight = 0f - ((Bounds)(ref Bounds)).min.y; Muzzle = new Vector3(0f, 0f, ((Bounds)(ref Bounds)).max.z); ManualLogSource log = Plugin.Log; object[] array9 = new object[7] { "Guitar mesh: ", array4.Length, " vertices, ", array8.Length / 3, " triangles, size ", null, null }; Vector3 size = ((Bounds)(ref Bounds)).size; array9[5] = ((Vector3)(ref size)).ToString("0.00"); array9[6] = "."; log.LogInfo((object)string.Concat(array9)); } internal static void CreatePrefab() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ce: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0162: Expected O, but got Unknown //IL_018a: 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_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) GameObject val = NetworkPrefabs.CreateNetworkPrefab("HiggsGuitarItem"); val.layer = 6; val.tag = "PhysicsProp"; float num = Plugin.ClampedScale(); val.transform.localScale = new Vector3(num, num, num); NetworkObject component = val.GetComponent<NetworkObject>(); component.AlwaysReplicateAsRoot = false; component.SynchronizeTransform = true; component.ActiveSceneSynchronization = false; component.SceneMigrationSynchronization = true; component.SpawnWithObservers = true; component.DontDestroyWithOwner = true; component.AutoObjectParentSync = false; val.AddComponent<MeshFilter>().sharedMesh = Mesh; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)val2).receiveShadows = true; ((Renderer)val2).motionVectorGenerationMode = (MotionVectorGenerationMode)0; BoxCollider val3 = val.AddComponent<BoxCollider>(); val3.center = ((Bounds)(ref Bounds)).center; val3.size = ((Bounds)(ref Bounds)).size + new Vector3(0.02f, 0.06f, 0.02f); ((Collider)val3).isTrigger = false; AudioSource source = val.AddComponent<AudioSource>(); SetUpSource(source, 3f, 18f); GameObject val4 = new GameObject("BlastAudio"); val4.layer = 6; val4.transform.SetParent(val.transform, false); val4.transform.localPosition = Muzzle * 0.5f; SetUpSource(val4.AddComponent<AudioSource>(), 5f, 70f); GameObject val5 = new GameObject("ScanNode"); val5.layer = 22; val5.transform.SetParent(val.transform, false); val5.transform.localPosition = ((Bounds)(ref Bounds)).center; BoxCollider val6 = val5.AddComponent<BoxCollider>(); val6.size = new Vector3(0.3f, 0.3f, 0.3f); ((Collider)val6).isTrigger = false; ScanNodeProperties val7 = val5.AddComponent<ScanNodeProperties>(); val7.headerText = "Higgs' guitar"; val7.subText = "Sonic blast"; val7.minRange = 1; val7.maxRange = 13; val7.requiresLineOfSight = true; val7.scrapValue = 0; val7.creatureScanID = -1; val7.nodeType = 0; Item val8 = ScriptableObject.CreateInstance<Item>(); ((Object)val8).name = "HiggsGuitar"; ((Object)val8).hideFlags = (HideFlags)61; val8.itemId = 684117; val8.itemName = "Higgs guitar"; val8.spawnPositionTypes = new List<ItemGroup>(); val8.twoHanded = false; val8.twoHandedAnimation = true; val8.disableHandsOnWall = false; val8.canBeGrabbedBeforeGameStart = true; val8.disallowUtilitySlot = true; val8.weight = 1.09f; val8.itemIsTrigger = false; val8.holdButtonUse = false; val8.itemSpawnsOnGround = true; val8.isConductiveMetal = true; val8.isScrap = false; val8.creditsWorth = Mathf.Max(0, Plugin.Price.Value); val8.highestSalePercentage = 80; val8.maxValue = 0; val8.minValue = 0; val8.spawnPrefab = val; val8.requiresBattery = false; val8.batteryUsage = 300f; val8.automaticallySetUsingPower = false; val8.grabAnim = "HoldShotgun"; val8.useAnim = ""; val8.pocketAnim = ""; val8.throwAnim = ""; val8.grabAnimationTime = 0f; val8.syncGrabFunction = false; val8.syncUseFunction = true; val8.syncDiscardFunction = true; val8.syncInteractLRFunction = false; val8.saveItemVariable = false; val8.isDefensiveWeapon = true; val8.toolTips = new string[1] { "Sonic blast : [RMB]" }; val8.floorYOffset = 0; val8.allowDroppingAheadOfPlayer = true; val8.restingRotation = Vector3.zero; val8.meshOffset = false; val8.meshVariants = (Mesh[])(object)new Mesh[0]; val8.materialVariants = (Material[])(object)new Material[0]; val8.clinkAudios = (AudioClip[])(object)new AudioClip[0]; val8.usableInSpecialAnimations = false; val8.canBeInspected = false; Item = val8; HiggsGuitarItem higgsGuitarItem = val.AddComponent<HiggsGuitarItem>(); ((GrabbableObject)higgsGuitarItem).itemProperties = val8; ((GrabbableObject)higgsGuitarItem).grabbable = true; ((GrabbableObject)higgsGuitarItem).grabbableToEnemies = true; ((GrabbableObject)higgsGuitarItem).mainObjectRenderer = val2; ((GrabbableObject)higgsGuitarItem).useCooldown = Mathf.Max(0.2f, Plugin.Cooldown.Value); ((GrabbableObject)higgsGuitarItem).floorYRot = -1; ((GrabbableObject)higgsGuitarItem).customGrabTooltip = ""; Prefab = val; } private static void SetUpSource(AudioSource source, float minDistance, float maxDistance) { source.playOnAwake = false; source.loop = false; source.spatialBlend = 1f; source.dopplerLevel = 0f; source.rolloffMode = (AudioRolloffMode)1; source.minDistance = minDistance; source.maxDistance = maxDistance; } internal static void FinishWhenPossible(string sceneName) { if ((Object)(object)Prefab == (Object)null) { return; } if (!finished) { Shader val = Shader.Find("HDRP/Lit"); if ((Object)(object)val == (Object)null && ++attempts < 4) { Plugin.Log.LogInfo((object)("Render pipeline not ready in scene '" + sceneName + "', finishing the guitar on the next scene.")); } else { finished = true; if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"Shader HDRP/Lit is not available; the guitar will have no material."); } else { Material = BuildMaterial(val); ((Renderer)Prefab.GetComponent<MeshRenderer>()).sharedMaterial = Material; } LoadSounds(); LoadIcon(); Plugin.Log.LogInfo((object)("Guitar finished in scene '" + sceneName + "': " + BlastClips.Length + " blast sounds.")); } } if ((Object)(object)StartOfRound.Instance != (Object)null) { BorrowFromShotgun(StartOfRound.Instance); } } private static void BorrowFromShotgun(StartOfRound round) { if ((Object)(object)round.allItemsList == (Object)null || round.allItemsList.itemsList == null) { return; } foreach (Item items in round.allItemsList.itemsList) { if ((Object)(object)items == (Object)null || (Object)(object)items.spawnPrefab == (Object)null || (Object)(object)items.spawnPrefab.GetComponent<ShotgunItem>() == (Object)null) { continue; } Item.grabSFX = items.grabSFX; Item.dropSFX = items.dropSFX; Item.pocketSFX = items.pocketSFX; Item.throwSFX = items.throwSFX; AudioSource component = items.spawnPrefab.GetComponent<AudioSource>(); if ((Object)(object)component != (Object)null) { AudioSource[] componentsInChildren = Prefab.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val in componentsInChildren) { val.outputAudioMixerGroup = component.outputAudioMixerGroup; } } BoxCollider component2 = items.spawnPrefab.GetComponent<BoxCollider>(); if ((Object)(object)component2 != (Object)null) { ((Collider)Prefab.GetComponent<BoxCollider>()).isTrigger = ((Collider)component2).isTrigger; } Prefab.layer = items.spawnPrefab.layer; Prefab.tag = items.spawnPrefab.tag; return; } Plugin.Log.LogWarning((object)"The shotgun was not found among the game's items; the guitar keeps its own sound settings."); } private static void LoadSounds() { List<AudioClip> list = new List<AudioClip>(); for (int i = 1; i <= 8; i++) { string text = Find("guitar_blast_" + i + ".wav"); if (text == null) { break; } try { list.Add(LoadWav(text)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Sound " + text + " could not be read: " + ex.Message)); } } if (list.Count == 0) { Plugin.Log.LogWarning((object)"No guitar_blast_N.wav files found; the blast will be silent."); } BlastClips = list.ToArray(); } private static AudioClip LoadWav(string path) { byte[] array = File.ReadAllBytes(path); if (array.Length < 44 || array[0] != 82 || array[1] != 73 || array[2] != 70 || array[3] != 70 || array[8] != 87 || array[9] != 65 || array[10] != 86 || array[11] != 69) { throw new InvalidDataException("not a WAV file"); } int num = 0; int num2 = 0; int num3 = 0; int num4 = -1; int num5 = 0; int num6; for (int i = 12; i + 8 <= array.Length; i += 8 + num6 + (num6 & 1)) { string text = Encoding.ASCII.GetString(array, i, 4); num6 = BitConverter.ToInt32(array, i + 4); if (text == "fmt ") { int num7 = BitConverter.ToInt16(array, i + 8); num = BitConverter.ToInt16(array, i + 10); num2 = BitConverter.ToInt32(array, i + 12); num3 = BitConverter.ToInt16(array, i + 22); if (num7 != 1 || num3 != 16) { throw new InvalidDataException("only 16 bit PCM is supported"); } } else if (text == "data") { num4 = i + 8; num5 = Math.Min(num6, array.Length - num4); break; } } if (num4 < 0 || num < 1 || num2 < 1) { throw new InvalidDataException("WAV file has no format or data chunk"); } int num8 = num5 / 2; float[] array2 = new float[num8]; for (int j = 0; j < num8; j++) { array2[j] = (float)BitConverter.ToInt16(array, num4 + j * 2) / 32768f; } AudioClip val = AudioClip.Create(Path.GetFileNameWithoutExtension(path), num8 / num, num, num2, false); val.SetData(array2, 0); ((Object)val).hideFlags = (HideFlags)61; return val; } private static void LoadIcon() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_006a: 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) string text = Find("guitar_icon.png"); if (text == null) { Plugin.Log.LogWarning((object)"guitar_icon.png is missing; the inventory slot will have no picture."); return; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text), true)) { Object.Destroy((Object)(object)val); return; } ((Object)val).name = "HiggsGuitarIcon"; ((Object)val).hideFlags = (HideFlags)61; Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)val2).name = "HiggsGuitarIcon"; ((Object)val2).hideFlags = (HideFlags)61; Item.itemIcon = val2; } private static Material BuildMaterial(Shader lit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0156: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(lit); ((Object)val).name = "HiggsGuitar"; ((Object)val).hideFlags = (HideFlags)61; val.SetColor("_BaseColor", Color.white); Texture2D val2 = LoadImage("guitar_bc", linear: false); if ((Object)(object)val2 != (Object)null) { Finish(val2); val.SetTexture("_BaseColorMap", (Texture)(object)val2); } Texture2D val3 = LoadImage("guitar_n", linear: true); if ((Object)(object)val3 != (Object)null) { Color32[] pixels = val3.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { ref Color32 reference = ref pixels[i]; reference = new Color32(byte.MaxValue, pixels[i].g, byte.MaxValue, pixels[i].r); } val.SetTexture("_NormalMap", (Texture)(object)FromPixels(val3, pixels, "guitar_n")); val.SetFloat("_NormalScale", 1f); val.EnableKeyword("_NORMALMAP"); val.EnableKeyword("_NORMALMAP_TANGENT_SPACE"); } Texture2D val4 = LoadImage("guitar_agm", linear: true); if ((Object)(object)val4 != (Object)null) { Color32[] pixels2 = val4.GetPixels32(); for (int j = 0; j < pixels2.Length; j++) { ref Color32 reference2 = ref pixels2[j]; reference2 = new Color32(pixels2[j].b, pixels2[j].r, (byte)0, pixels2[j].g); } val.SetTexture("_MaskMap", (Texture)(object)FromPixels(val4, pixels2, "guitar_mask")); val.EnableKeyword("_MASKMAP"); val.SetFloat("_Metallic", 1f); val.SetFloat("_MetallicRemapMin", 0f); val.SetFloat("_MetallicRemapMax", 1f); val.SetFloat("_AORemapMin", 0f); val.SetFloat("_AORemapMax", 1f); val.SetFloat("_SmoothnessRemapMin", 0f); val.SetFloat("_SmoothnessRemapMax", Mathf.Clamp01(Plugin.MaxSmoothness.Value)); } else { val.SetFloat("_Metallic", 0f); val.SetFloat("_Smoothness", 0.3f); } try { Validate(val); } catch (Exception ex) { Plugin.Log.LogWarning((object)("HDRP material validation is unavailable (" + ex.GetType().Name + "); keywords set by hand.")); } return val; } internal static void Validate(Material m) { HDMaterial.ValidateMaterial(m); } private static Texture2D LoadImage(string name, bool linear) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown string text = Find(name + ".png"); if (text == null) { text = Find(name + ".jpg"); } if (text == null) { Plugin.Log.LogWarning((object)("Texture " + name + " is missing.")); return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true, linear); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text), false)) { Plugin.Log.LogWarning((object)("Texture " + text + " could not be decoded.")); Object.Destroy((Object)(object)val); return null; } ((Object)val).name = name; return val; } private static Texture2D FromPixels(Texture2D source, Color32[] pixels, string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Texture2D val = new Texture2D(((Texture)source).width, ((Texture)source).height, (TextureFormat)4, true, true); ((Object)val).name = name; val.SetPixels32(pixels); val.Apply(true, false); Object.Destroy((Object)(object)source); Finish(val); return val; } private static void Finish(Texture2D tex) { ((Object)tex).hideFlags = (HideFlags)61; ((Texture)tex).wrapMode = (TextureWrapMode)1; ((Texture)tex).filterMode = (FilterMode)2; ((Texture)tex).anisoLevel = 4; if (Plugin.CompressTextures.Value && ((Texture)tex).width % 4 == 0 && ((Texture)tex).height % 4 == 0) { tex.Compress(true); } tex.Apply(false, true); } private static string Find(string fileName) { string text = Path.Combine(Directory, fileName); if (File.Exists(text)) { return text; } string text2 = Path.Combine(Path.Combine(Directory, "higgsguitar"), fileName); if (File.Exists(text2)) { return text2; } string[] files = System.IO.Directory.GetFiles(Directory, fileName, SearchOption.AllDirectories); if (files.Length <= 0) { return null; } return files[0]; } private static float[] ReadFloats(BinaryReader r, int count) { byte[] array = r.ReadBytes(count * 4); if (array.Length != count * 4) { throw new EndOfStreamException("model file is truncated"); } float[] array2 = new float[count]; Buffer.BlockCopy(array, 0, array2, 0, array.Length); return array2; } } public static class PoseLoop { [StructLayout(LayoutKind.Sequential, Size = 1)] private struct BeforeLateUpdate { } [StructLayout(LayoutKind.Sequential, Size = 1)] private struct AfterLateUpdate { } internal static int LastFrame = -1; public static readonly Stopwatch Cost = new Stopwatch(); private static bool reported; internal static void Install() { //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_00cf: 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_00f9: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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) PlayerLoopSystem currentPlayerLoop = PlayerLoop.GetCurrentPlayerLoop(); if (currentPlayerLoop.subSystemList == null) { Plugin.Log.LogWarning((object)"The player loop is empty; the hands will be posed from LateUpdate instead."); return; } for (int i = 0; i < currentPlayerLoop.subSystemList.Length; i++) { if (currentPlayerLoop.subSystemList[i].type != typeof(PreLateUpdate) || currentPlayerLoop.subSystemList[i].subSystemList == null) { continue; } List<PlayerLoopSystem> list = new List<PlayerLoopSystem>(currentPlayerLoop.subSystemList[i].subSystemList); if (list.FindIndex((PlayerLoopSystem s) => s.type == typeof(BeforeLateUpdate)) < 0) { int num = list.FindIndex((PlayerLoopSystem s) => s.type == typeof(ScriptRunBehaviourLateUpdate)); if (num < 0) { break; } PlayerLoopSystem item = new PlayerLoopSystem { type = typeof(BeforeLateUpdate), updateDelegate = new UpdateFunction(RunBefore) }; list.Insert(num + 1, new PlayerLoopSystem { type = typeof(AfterLateUpdate), updateDelegate = new UpdateFunction(RunAfter) }); list.Insert(num, item); currentPlayerLoop.subSystemList[i].subSystemList = list.ToArray(); PlayerLoop.SetPlayerLoop(currentPlayerLoop); Plugin.Log.LogInfo((object)"Pose steps added around LateUpdate."); } return; } Plugin.Log.LogWarning((object)"LateUpdate was not found in the player loop; the hands will be posed from LateUpdate instead."); } private static void RunBefore() { LastFrame = Time.frameCount; Cost.Start(); try { HiggsGuitarItem.PoseAll(afterLateUpdate: false); } catch (Exception e) { Report(e); } Cost.Stop(); } private static void RunAfter() { Cost.Start(); try { HiggsGuitarItem.PoseAll(afterLateUpdate: true); } catch (Exception e) { Report(e); } Cost.Stop(); } private static void Report(Exception e) { if (!reported) { reported = true; Plugin.Log.LogError((object)("Posing the guitar failed (reported once).\n" + e)); } } } internal class Arm { internal Transform Upper; internal Transform Lower; internal Transform Hand; internal bool Valid { get { if ((Object)(object)Upper != (Object)null && (Object)(object)Lower != (Object)null) { return (Object)(object)Hand != (Object)null; } return false; } } internal static Arm Find(Transform[] bones, string side) { Arm arm = new Arm(); if (bones == null) { return arm; } foreach (Transform val in bones) { if (!((Object)(object)val == (Object)null)) { if (((Object)val).name == "arm." + side + "_upper") { arm.Upper = val; } else if (((Object)val).name == "arm." + side + "_lower") { arm.Lower = val; } else if (((Object)val).name == "hand." + side) { arm.Hand = val; } } } return arm; } internal void Reach(Vector3 wrist, Quaternion hand, Vector3 elbowHint, float weight) { //IL_0018: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cc: 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_00d8: 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_0106: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_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_0180: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01b3: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) if (Valid && !(weight <= 0f)) { Quaternion rotation = Upper.rotation; Quaternion rotation2 = Lower.rotation; Quaternion rotation3 = Hand.rotation; Vector3 position = Upper.position; float num = Vector3.Distance(position, Lower.position); float num2 = Vector3.Distance(Lower.position, Hand.position); Vector3 val = wrist - position; float num3 = Mathf.Clamp(((Vector3)(ref val)).magnitude, Mathf.Abs(num - num2) + 0.01f, num + num2 - 0.005f); Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val)).normalized : Upper.up); Vector3 val3 = elbowHint - val2 * Vector3.Dot(elbowHint, val2); Vector3 normalized; if (!(((Vector3)(ref val3)).sqrMagnitude > 1E-08f)) { Vector3 val4 = Vector3.Cross(val2, Vector3.up); normalized = ((Vector3)(ref val4)).normalized; } else { normalized = ((Vector3)(ref val3)).normalized; } val3 = normalized; float num4 = Mathf.Clamp((num * num + num3 * num3 - num2 * num2) / (2f * num * num3), -1f, 1f); Vector3 val5 = position + val2 * (num * num4) + val3 * (num * Mathf.Sqrt(1f - num4 * num4)); Upper.rotation = Quaternion.FromToRotation(Lower.position - position, val5 - position) * Upper.rotation; Lower.rotation = Quaternion.FromToRotation(Hand.position - Lower.position, position + val2 * num3 - Lower.position) * Lower.rotation; Hand.rotation = hand; if (weight < 1f) { Quaternion rotation4 = Upper.rotation; Quaternion rotation5 = Lower.rotation; Upper.rotation = Quaternion.Slerp(rotation, rotation4, weight); Lower.rotation = Quaternion.Slerp(rotation2, rotation5, weight); Hand.rotation = Quaternion.Slerp(rotation3, hand, weight); } } } } internal class FingerPose { internal readonly float[] Knuckle; internal readonly float[] Tip; internal readonly float[] Spread; internal FingerPose(float[] knuckle, float[] tip, float[] spread) { Knuckle = knuckle; Tip = tip; Spread = spread; } internal FingerPose() : this(new float[5], new float[5], new float[5]) { } internal void Approach(FingerPose target, float degrees) { for (int i = 0; i < 5; i++) { Knuckle[i] = Mathf.MoveTowards(Knuckle[i], target.Knuckle[i], degrees); Tip[i] = Mathf.MoveTowards(Tip[i], target.Tip[i], degrees); Spread[i] = Mathf.MoveTowards(Spread[i], target.Spread[i], degrees); } } internal void Blend(FingerPose a, FingerPose b, float t) { for (int i = 0; i < 5; i++) { Knuckle[i] = Mathf.Lerp(a.Knuckle[i], b.Knuckle[i], t); Tip[i] = Mathf.Lerp(a.Tip[i], b.Tip[i], t); Spread[i] = Mathf.Lerp(a.Spread[i], b.Spread[i], t); } } } internal class Fingers { private readonly Transform[] knuckles = (Transform[])(object)new Transform[5]; private readonly Transform[] tips = (Transform[])(object)new Transform[5]; private readonly Quaternion[] knuckleRest = (Quaternion[])(object)new Quaternion[5]; private readonly Quaternion[] tipRest = (Quaternion[])(object)new Quaternion[5]; private float thumbSide; internal bool Valid; internal static Fingers Find(SkinnedMeshRenderer renderer, string side) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0156: 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_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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) Fingers fingers = new Fingers(); fingers.thumbSide = ((side == "R") ? 1f : (-1f)); if ((Object)(object)renderer == (Object)null || (Object)(object)renderer.sharedMesh == (Object)null) { return fingers; } Transform[] bones = renderer.bones; Matrix4x4[] bindposes = renderer.sharedMesh.bindposes; int num = Index(bones, "hand." + side); if (num < 0 || bindposes == null || bindposes.Length != bones.Length) { return fingers; } for (int i = 0; i < 5; i++) { int num2 = Index(bones, "finger" + (i + 1) + "." + side); int num3 = Index(bones, "finger" + (i + 1) + "." + side + ".001"); if (num2 < 0 || num3 < 0) { return fingers; } fingers.knuckles[i] = bones[num2]; fingers.tips[i] = bones[num3]; ref Quaternion reference = ref fingers.knuckleRest[i]; reference = Quaternion.Inverse(Rest(bindposes[num])) * Rest(bindposes[num2]); ref Quaternion reference2 = ref fingers.tipRest[i]; reference2 = Quaternion.Inverse(Rest(bindposes[num2])) * Rest(bindposes[num3]); } fingers.Valid = true; return fingers; } internal void Apply(FingerPose pose, float weight) { //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_00d8: 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_00e2: 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_00fd: 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_0118: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_0169: 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_0162: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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) if (!Valid || weight <= 0f) { return; } for (int i = 0; i < 5; i++) { Quaternion val; Quaternion val2; if (i == 0) { val = Quaternion.AngleAxis(thumbSide * pose.Knuckle[i], Vector3.up) * Quaternion.AngleAxis((0f - thumbSide) * pose.Spread[i], Vector3.forward) * knuckleRest[i]; val2 = Quaternion.AngleAxis(thumbSide * pose.Tip[i], Quaternion.Inverse(knuckleRest[i]) * Vector3.up) * tipRest[i]; } else { val = Quaternion.AngleAxis(pose.Spread[i], Vector3.forward) * Quaternion.AngleAxis(0f - pose.Knuckle[i], Vector3.right) * knuckleRest[i]; val2 = Quaternion.AngleAxis(0f - pose.Tip[i], Quaternion.Inverse(knuckleRest[i]) * Vector3.right) * tipRest[i]; } knuckles[i].localRotation = ((weight >= 1f) ? val : Quaternion.Slerp(knuckles[i].localRotation, val, weight)); tips[i].localRotation = ((weight >= 1f) ? val2 : Quaternion.Slerp(tips[i].localRotation, val2, weight)); } } private static int Index(Transform[] bones, string name) { for (int i = 0; i < bones.Length; i++) { if ((Object)(object)bones[i] != (Object)null && ((Object)bones[i]).name == name) { return i; } } return -1; } private static Quaternion Rest(Matrix4x4 bindpose) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) Matrix4x4 inverse = ((Matrix4x4)(ref bindpose)).inverse; return Quaternion.LookRotation(Vector4.op_Implicit(((Matrix4x4)(ref inverse)).GetColumn(2)), Vector4.op_Implicit(((Matrix4x4)(ref inverse)).GetColumn(1))); } } internal static class HandPose { internal static float Bump(float a, float peak, float b, float value) { if (!(value <= peak)) { return 1f - Smooth(peak, b, value); } return Smooth(a, peak, value); } internal static Quaternion Facing(Vector3 fingers, Vector3 palm) { //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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Quaternion.LookRotation(-palm, fingers); } internal static float Smooth(float from, float to, float value) { return Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(from, to, value)); } } public class HiggsGuitarItem : GrabbableObject { private const int EnemiesLayer = 19; private const int HazardsLayer = 21; private const int PlayersLayer = 3; private const float BackSurface = 0.4587f; private const float StrumEnd = 0.1f; private const float ReleaseAt = 0.16f; private const float ThrustFull = 0.19f; private const float ThrustHeld = 0.42f; private const float ThrustBack = 0.68f; private const float DrawTime = 0.34f; private static readonly Vector3 SpineBindEuler = new Vector3(-5.219f, 0f, 0f); private AudioSource blastAudio; private GameObject backVisual; private MeshRenderer backRenderer; private PlayerControllerB backOwner; private Transform backBone; private int backRevision = -1; private bool backOnModelSuit; private float nextBackCheck; internal static readonly List<HiggsGuitarItem> All = new List<HiggsGuitarItem>(); private static readonly FingerPose[] Chords = new FingerPose[3] { new FingerPose(new float[5] { 28f, 58f, 66f, 60f, 50f }, new float[5] { 20f, 72f, 80f, 74f, 62f }, new float[5] { 0f, 6f, 0f, -4f, -8f }), new FingerPose(new float[5] { 34f, 70f, 52f, 68f, 62f }, new float[5] { 26f, 60f, 84f, 66f, 78f }, new float[5] { 0f, 10f, 2f, -2f, -12f }), new FingerPose(new float[5] { 24f, 50f, 72f, 54f, 70f }, new float[5] { 18f, 80f, 64f, 82f, 58f }, new float[5] { 0f, 2f, -2f, -8f, -14f }) }; private static readonly float[] ChordShift = new float[3] { 0f, -0.13f, 0.09f }; private static readonly FingerPose Picking = new FingerPose(new float[5] { 22f, 38f, 44f, 48f, 52f }, new float[5] { 14f, 46f, 52f, 56f, 60f }, new float[5] { 0f, 4f, 0f, -3f, -6f }); private static readonly FingerPose OpenPalm = new FingerPose(new float[5] { -12f, 6f, 9f, 12f, 16f }, new float[5] { -4f, 10f, 12f, 14f, 18f }, new float[5] { 22f, 11f, 0f, -10f, -20f }); private float useStart = -100f; private bool released = true; private int useCount; private PlayerControllerB rigOwner; private Transform chest; private Transform waist; private Transform head; private Arm bodyLeft; private Arm bodyRight; private Arm viewLeft; private Arm viewRight; private Fingers bodyLeftFingers; private Fingers bodyRightFingers; private Fingers viewLeftFingers; private Fingers viewRightFingers; private readonly FingerPose leftFingers = new FingerPose(); private readonly FingerPose rightFingers = new FingerPose(); private float chordShift; private float poseWeight; private float drawStart = -100f; private float walk; private Vector3 lastPlace; private bool posed; private Transform modelLeftHand; private Transform modelRightHand; private float nextModelLook; private float bodyInto; private float modelSlide; private Vector3 modelShift; private Vector3 bodyPosition; private Vector3 bodyGripTarget; private Vector3 bodyWristTarget; private Quaternion bodyFrame = Quaternion.identity; private Quaternion bodyRotation = Quaternion.identity; private Quaternion modelTurn = Quaternion.identity; private Vector3 posedPosition; private Vector3 palmPosition; private Quaternion posedRotation = Quaternion.identity; private static Action<ScriptableRenderContext, List<Camera>> renderStep; private static readonly Vector3 ViewHead = new Vector3(-0.88f, 0.22f, 0.38f); private static readonly Vector3 ViewFront = new Vector3(0f, 0.8f, -0.6f); private float Drawn => HandPose.Smooth(0f, 0.34f, Time.time - drawStart); public override void Start() { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { ((Object)((Component)val).gameObject).hideFlags = (HideFlags)0; } ((GrabbableObject)this).Start(); All.Add(this); Transform val2 = ((Component)this).transform.Find("BlastAudio"); blastAudio = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<AudioSource>() : ((Component)this).GetComponent<AudioSource>()); } public override void Update() { ((GrabbableObject)this).Update(); Plugin.WatchSettingsFile(); UpdateUse(); UpdateBackVisual(); } public override void OnDestroy() { All.Remove(this); RemoveBackVisual(); ((GrabbableObject)this).OnDestroy(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); PlayerControllerB playerHeldBy = base.playerHeldBy; if (buttonDown && !((Object)(object)playerHeldBy == (Object)null)) { BeginUse(); } } private void Release(PlayerControllerB player, Vector3 palm) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_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_0030: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0262: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: 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) Transform val = (((Object)(object)player.gameplayCamera != (Object)null) ? ((Component)player.gameplayCamera).transform : ((Component)player).transform); Vector3 position = val.position; Vector3 forward = val.forward; Vector3 val2 = palm + forward * 0.12f; float num = Mathf.Max(1f, Plugin.Range.Value); float num2 = Mathf.Clamp(Plugin.ConeAngle.Value * 0.5f, 2f, 85f); bool isOwner = ((NetworkBehaviour)this).IsOwner; if ((Object)(object)RoundManager.Instance != (Object)null) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, Mathf.Max(0f, Plugin.NoiseRange.Value), 0.9f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } player.timeSinceMakingLoudNoise = 0f; SonicWave.Spawn(val2, forward, num, num2); PlayerControllerB val3 = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if (isOwner) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if ((Object)(object)val3 != (Object)null && Vector3.Distance(((Component)val3).transform.position, val2) < 10f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } int num3 = 524288; if (isOwner && Plugin.HitHazards.Value) { num3 |= 0x200000; } if (isOwner && Plugin.FriendlyFire.Value) { num3 |= 8; } Collider[] array = Physics.OverlapSphere(position, num, num3, (QueryTriggerInteraction)2); List<EnemyAI> list = new List<EnemyAI>(); List<EnemyAI> list2 = new List<EnemyAI>(); List<IHittable> list3 = new List<IHittable>(); float num4 = Mathf.Max(0f, Plugin.StunSeconds.Value); Collider[] array2 = array; foreach (Collider val4 in array2) { if ((Object)(object)val4 == (Object)null || ((Component)val4).transform.IsChildOf(((Component)player).transform)) { continue; } Bounds bounds = val4.bounds; float num5 = Mathf.Clamp(Vector3.Dot(((Bounds)(ref bounds)).center - position, forward), 0f, num); Vector3 val5 = ((Bounds)(ref bounds)).ClosestPoint(position + forward * num5); Vector3 val6 = val5 - position; float magnitude = ((Vector3)(ref val6)).magnitude; if (magnitude > num || (magnitude > 1.5f && Vector3.Angle(forward, val6) > num2) || (Physics.Linecast(position, ((Bounds)(ref bounds)).center, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Physics.Linecast(position, val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { continue; } EnemyAICollisionDetect component = ((Component)val4).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null) { EnemyAI mainScript = component.mainScript; if ((Object)(object)mainScript == (Object)null || mainScript.isEnemyDead) { continue; } if (num4 > 0f && !list2.Contains(mainScript)) { list2.Add(mainScript); mainScript.SetEnemyStunned(true, num4, player); } if (isOwner && !list.Contains(mainScript)) { int num6 = ((magnitude < Plugin.CloseRange.Value) ? Plugin.CloseDamage.Value : Plugin.Damage.Value); if (num6 <= 0 || Hit((IHittable)(object)component, num6, forward, player)) { list.Add(mainScript); } } } else if (isOwner) { IHittable component2 = ((Component)val4).GetComponent<IHittable>(); if (component2 == null && (Object)(object)val4.attachedRigidbody != (Object)null) { component2 = ((Component)val4.attachedRigidbody).GetComponent<IHittable>(); } if (component2 != null && !list3.Contains(component2) && (!(component2 is PlayerControllerB) || Plugin.FriendlyFire.Value)) { list3.Add(component2); Hit(component2, Mathf.Max(1, Plugin.Damage.Value), forward, player); } } } } private static bool Hit(IHittable hittable, int force, Vector3 direction, PlayerControllerB player) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) try { return hittable.Hit(force, direction, player, true, -1); } catch (Exception ex) { Plugin.Log.LogWarning((object)("A target threw while being hit by the wave: " + ex.Message)); return true; } } private void UpdateBackVisual() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; if (Plugin.ShowOnBack.Value && base.isHeld && base.isPocketed && !base.deactivated && (Object)(object)base.playerHeldBy != (Object)null && !base.playerHeldBy.isPlayerDead && base.playerHeldBy.isPlayerControlled) { val = base.playerHeldBy; } if ((Object)(object)val != (Object)(object)backOwner || ((Object)(object)val != (Object)null && (Object)(object)backVisual == (Object)null)) { RemoveBackVisual(); backOwner = val; if ((Object)(object)val != (Object)null) { CreateBackVisual(val); } } if ((Object)(object)backVisual == (Object)null) { return; } if (Time.time >= nextBackCheck) { nextBackCheck = Time.time + 1f; bool flag = WearsModelSuit(val); if (flag != backOnModelSuit) { backOnModelSuit = flag; backRevision = -1; } PlayerControllerB val2 = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); bool flag2 = (Object)(object)val == (Object)(object)val2 && !Plugin.ShowOwnOnBack.Value && (Object)(object)val.thisPlayerModel != (Object)null; ((Renderer)backRenderer).shadowCastingMode = (ShadowCastingMode)((!flag2) ? 1 : (backOnModelSuit ? 3 : ((int)((Renderer)val.thisPlayerModel).shadowCastingMode))); ((Renderer)backRenderer).sharedMaterial = GuitarAssets.Material; } if (backRevision != Plugin.Revision) { backRevision = Plugin.Revision; PlaceBackVisual(); } } private void CreateBackVisual(PlayerControllerB owner) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown backBone = FindBone(owner, "spine.003"); if ((Object)(object)backBone == (Object)null) { backBone = owner.upperSpine; } if (!((Object)(object)backBone == (Object)null)) { backVisual = new GameObject("HiggsGuitarOnBack"); backVisual.layer = ((Component)this).gameObject.layer; backVisual.transform.SetParent(backBone, false); backVisual.AddComponent<MeshFilter>().sharedMesh = GuitarAssets.Mesh; backRenderer = backVisual.AddComponent<MeshRenderer>(); ((Renderer)backRenderer).sharedMaterial = GuitarAssets.Material; ((Renderer)backRenderer).renderingLayerMask = 1u; ((Renderer)backRenderer).motionVectorGenerationMode = (MotionVectorGenerationMode)0; backOnModelSuit = WearsModelSuit(owner); backRevision = -1; nextBackCheck = 0f; } } private static void BackPlace(bool onModelSuit, out Vector3 offset, out Quaternion rotation) { //IL_002a: 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_007e: 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) float num = Plugin.BackTilt.Value * ((float)Math.PI / 180f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Sin(num), Mathf.Cos(num), 0f); rotation = Quaternion.LookRotation(val, Vector3.back); float num2 = 0.4587f + Plugin.BackGap.Value + GuitarAssets.RestHeight * Plugin.ClampedScale(); if (onModelSuit) { num2 -= Plugin.BackModelSuitInset.Value; } offset = new Vector3(Plugin.BackSide.Value, Plugin.BackHeight.Value, 0f - num2); } private void PlaceBackVisual() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //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_002b: 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_0051: 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_005e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) float num = Plugin.ClampedScale(); BackPlace(backOnModelSuit, out var offset, out var rotation); Quaternion val = Quaternion.Inverse(Quaternion.Euler(SpineBindEuler)); float num2 = Mathf.Max(backBone.lossyScale.x, 0.0001f); Transform transform = backVisual.transform; transform.localRotation = val * rotation; transform.localPosition = val * offset / num2; transform.localScale = Vector3.one * (num / num2); } private void RemoveBackVisual() { if ((Object)(object)backVisual != (Object)null) { Object.Destroy((Object)(object)backVisual); } backVisual = null; backRenderer = null; backBone = null; backOwner = null; } private static Transform FindBone(PlayerControllerB player, string boneName) { if ((Object)(object)player.thisPlayerModel == (Object)null) { return null; } Transform[] bones = player.thisPlayerModel.bones; foreach (Transform val in bones) { if ((Object)(object)val != (Object)null && ((Object)val).name == boneName) { return val; } } return null; } private static bool WearsModelSuit(PlayerControllerB player) { MonoBehaviour[] components = ((Component)player).GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val in components) { if ((Object)(object)val == (Object)null) { continue; } Type type = ((object)val).GetType(); while (type != null) { if (type.Name == "BodyReplacementBase") { return true; } type = type.BaseType; } } return false; } internal static void PoseAll(bool afterLateUpdate) { for (int i = 0; i < All.Count; i++) { if ((Object)(object)All[i] != (Object)null) { All[i].Pose(afterLateUpdate); } } if (afterLateUpdate) { if (renderStep == null) { renderStep = HoldInPlace; } RenderPipelineManager.beginContextRendering -= renderStep; if (All.Count > 0) { RenderPipelineManager.beginContextRendering += renderStep; } } } private static void HoldInPlace(ScriptableRenderContext context, List<Camera> cameras) { //IL_0028: 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) for (int i = 0; i < All.Count; i++) { HiggsGuitarItem higgsGuitarItem = All[i]; if ((Object)(object)higgsGuitarItem != (Object)null && higgsGuitarItem.posed) { ((Component)higgsGuitarItem).transform.SetPositionAndRotation(higgsGuitarItem.posedPosition, higgsGuitarItem.posedRotation); } } } public override void LateUpdate() { ((GrabbableObject)this).LateUpdate(); if (PoseLoop.LastFrame != Time.frameCount) { Pose(afterLateUpdate: false); Pose(afterLateUpdate: true); PoseAll(afterLateUpdate: true); } } private bool BeingPlayed(PlayerControllerB player) { if (base.isHeld && !base.isPocketed && !base.deactivated && (Object)(object)player != (Object)null && !player.isPlayerDead && player.isPlayerControlled && !player.inSpecialInteractAnimation && !player.isClimbingLadder && (Object)(object)base.mainObjectRenderer != (Object)null) { return ((Renderer)base.mainObjectRenderer).enabled; } return false; } private void Pose(bool afterLateUpdate) { //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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_0228: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: 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_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0316: 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) PlayerControllerB playerHeldBy = base.playerHeldBy; if (!BeingPlayed(playerHeldBy)) { posed = false; poseWeight = 0f; return; } if ((Object)(object)rigOwner != (Object)(object)playerHeldBy) { rigOwner = playerHeldBy; chest = FindBone(playerHeldBy, "spine.003"); if ((Object)(object)chest == (Object)null) { chest = playerHeldBy.upperSpine; } waist = FindBone(playerHeldBy, "spine.002"); head = FindBone(playerHeldBy, "spine.004"); Transform[] bones = (((Object)(object)playerHeldBy.thisPlayerModel != (Object)null) ? playerHeldBy.thisPlayerModel.bones : null); Transform[] bones2 = (((Object)(object)playerHeldBy.thisPlayerModelArms != (Object)null) ? playerHeldBy.thisPlayerModelArms.bones : null); bodyLeft = Arm.Find(bones, "L"); bodyRight = Arm.Find(bones, "R"); viewLeft = Arm.Find(bones2, "L"); viewRight = Arm.Find(bones2, "R"); bodyLeftFingers = Fingers.Find(playerHeldBy.thisPlayerModel, "L"); bodyRightFingers = Fingers.Find(playerHeldBy.thisPlayerModel, "R"); viewLeftFingers = Fingers.Find(playerHeldBy.thisPlayerModelArms, "L"); viewRightFingers = Fingers.Find(playerHeldBy.thisPlayerModelArms, "R"); leftFingers.Blend(Chords[0], Chords[0], 0f); } if ((Object)(object)chest == (Object)null || !bodyLeft.Valid || !bodyRight.Valid) { posed = false; return; } bool flag = (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)playerHeldBy.gameplayCamera != (Object)null && viewLeft.Valid && viewRight.Valid; float t = Time.time - useStart; Vector3 position; Quaternion rotation; if (!afterLateUpdate) { if (!posed) { drawStart = Time.time; lastPlace = ((Component)playerHeldBy).transform.position; } Advance(playerHeldBy, t); MoveBody(playerHeldBy, t); Quaternion val = chest.rotation * Quaternion.Inverse(Quaternion.Euler(SpineBindEuler)); BodyPose(val, t, out position, out rotation); Vector3 val2 = PoseArms(bodyLeft, bodyRight, position, rotation, val, playerHeldBy, t, ownView: false); bodyLeftFingers.Apply(leftFingers, poseWeight); bodyRightFingers.Apply(rightFingers, poseWeight); bodyFrame = val; bodyPosition = position; bodyRotation = rotation; if (!flag) { posedPosition = position + val * modelShift; posedRotation = val * modelTurn * Quaternion.Inverse(val) * rotation; palmPosition = val2; } } else if (!flag) { FitToModel(playerHeldBy); } if (flag) { Transform transform = ((Component)playerHeldBy.gameplayCamera).transform; ViewPose(transform, t, out position, out rotation); palmPosition = PoseArms(viewLeft, viewRight, position, rotation, transform.rotation, playerHeldBy, t, ownView: true); viewLeftFingers.Apply(leftFingers, poseWeight); viewRightFingers.Apply(rightFingers, poseWeight); posedPosition = position; posedRotation = rotation; } posed = true; ((Component)this).transform.SetPositionAndRotation(posedPosition, posedRotation); } private void FitToModel(PlayerControllerB player) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0099: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: 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) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_02fe: 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_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: 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_01ef: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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) if (Time.time >= nextModelLook) { nextModelLook = Time.time + 1f; FindModelHands(player); } float num = 1f - Mathf.Exp(-10f * Time.deltaTime); Quaternion val = Quaternion.Inverse(bodyFrame); Vector3 val2 = Vector3.zero; bool flag = (Object)(object)modelLeftHand != (Object)null && (Object)(object)modelRightHand != (Object)null && poseWeight >= 1f; if (!flag) { modelTurn = Quaternion.Slerp(modelTurn, Quaternion.identity, num); } Vector3 val3 = bodyRotation * Vector3.forward; if (flag && bodyInto < 0.02f) { Vector3 val4 = bodyGripTarget - bodyWristTarget; float num2 = Vector3.Dot(val4, val3); Vector3 val5 = modelLeftHand.position - modelRightHand.position; float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude; Vector3 val6 = val4 - val3 * num2; float num3 = sqrMagnitude - ((Vector3)(ref val6)).sqrMagnitude; modelSlide = Mathf.Lerp(modelSlide, Mathf.Clamp((num2 - Mathf.Sqrt(Mathf.Max(num3, 0.01f))) * 0.5f, -0.15f, 0.15f), num); } Vector3 val7 = bodyGripTarget - val3 * modelSlide; Vector3 val8 = bodyWristTarget + val3 * (modelSlide * (1f - bodyInto)); if (flag && bodyInto < 0.02f) { Quaternion val9 = Quaternion.FromToRotation(val7 - val8, modelLeftHand.position - modelRightHand.position); if (Quaternion.Angle(Quaternion.identity, val9) < 30f) { modelTurn = Quaternion.Slerp(modelTurn, val * val9 * bodyFrame, num); } } Quaternion val10 = bodyFrame * modelTurn * val; if (flag) { Vector3 val11 = bodyPosition + val10 * (val7 - bodyPosition); Vector3 val12 = bodyPosition + val10 * (val8 - bodyPosition); float num4 = 1f - bodyInto; Vector3 val13 = (modelLeftHand.position - val11 + (modelRightHand.position - val12) * num4) / (1f + num4); val2 = val * val13; if (((Vector3)(ref val2)).sqrMagnitude > 0.36f) { val2 = Vector3.zero; } } modelShift = Vector3.Lerp(modelShift, val2, num); posedPosition = bodyPosition + bodyFrame * modelShift; posedRotation = val10 * bodyRotation; ((Component)this).transform.SetPositionAndRotation(posedPosition, posedRotation); } private void FindModelHands(PlayerControllerB player) { modelLeftHand = null; modelRightHand = null; MonoBehaviour[] components = ((Component)player).GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val in components) { if ((Object)(object)val == (Object)null) { continue; } Type type = ((object)val).GetType(); while (type != null) { if (!(type.Name != "BodyReplacementBase")) { FieldInfo field = type.GetField("replacementModel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); GameObject val2 = (GameObject)((field != null) ? /*isinst with value type is only supported in some contexts*/: null); Animator val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponentInChildren<Animator>() : null); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.avatar != (Object)null && val3.isHuman) { modelLeftHand = val3.GetBoneTransform((HumanBodyBones)17); modelRightHand = val3.GetBoneTransform((HumanBodyBones)18); } return; } type = type.BaseType; } } } private float Out(float t) { return HandPose.Smooth(0.1f, 0.19f, t) * (1f - HandPose.Smooth(0.42f, 0.68f, t)); } private void Advance(PlayerControllerB player, float t) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) float num = Mathf.Max(Time.deltaTime, 0.0001f); poseWeight = HandPose.Smooth(0.119f, 0.34f, Time.time - drawStart); int num2 = Mathf.Max(useCount - 1, 0) % Chords.Length; leftFingers.Approach(Chords[num2], 420f * num); chordShift = Mathf.MoveTowards(chordShift, ChordShift[num2], 0.9f * num); rightFingers.Blend(Picking, OpenPalm, HandPose.Smooth(0.08f, 0.16f, t) * (1f - HandPose.Smooth(0.42f, 0.62f, t))); Vector3 position = ((Component)player).transform.position; float num3 = Vector3.Distance(position, lastPlace) / num; lastPlace = position; walk = Mathf.Lerp(walk, Mathf.Clamp01(num3 / 4.5f), 8f * num); } private void MoveBody(PlayerControllerB player, float t) { //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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007e: 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_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_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_00e5: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0105: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)waist == (Object)null) && !(t > 0.88f)) { float num = Out(t) * poseWeight; float num2 = HandPose.Bump(0f, 0.05f, 0.16f, t) * poseWeight; float num3 = -9f * num; float num4 = 5f * num - 5f * num2; Vector3 up = ((Component)player).transform.up; Vector3 right = ((Component)player).transform.right; waist.rotation = Quaternion.AngleAxis(num3, up) * Quaternion.AngleAxis(num4, right) * waist.rotation; if ((Object)(object)head != (Object)null) { float num5 = 15f * HandPose.Bump(0.1f, 0.19999999f, 0.47f, t) * poseWeight; head.rotation = Quaternion.AngleAxis((0f - num3) * 0.85f, up) * Quaternion.AngleAxis(num5, right) * head.rotation; } } } private Quaternion Liveliness(float t) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: Unknown result type (might be due to invalid IL or missing references) float num = 7f * HandPose.Bump(0f, 0.045f, 0.3f, t); float num2 = Mathf.Sin(Time.time * 7.5f) * 2.2f * walk; return Quaternion.AngleAxis(num + num2, Vector3.up) * Quaternion.AngleAxis(Mathf.Cos(Time.time * 7.5f) * 1.2f * walk, Vector3.forward); } private void BodyPose(Quaternion frame, float t, out Vector3 position, out Quaternion rotation) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_011f: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) float num = Plugin.HoldNeckAngle.Value * ((float)Math.PI / 180f); float num2 = Plugin.HoldFaceTilt.Value * ((float)Math.PI / 180f); Vector3 val = new Vector3(0f - Mathf.Cos(num), Mathf.Sin(num), 0.18f); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, Mathf.Sin(num2), Mathf.Cos(num2)); Quaternion val3 = Quaternion.LookRotation(normalized, val2) * Liveliness(t); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(Plugin.HoldRight.Value, Plugin.HoldUp.Value, Plugin.HoldForward.Value); val4.y += Mathf.Abs(Mathf.Sin(Time.time * 7.5f)) * 0.012f * walk; float drawn = Drawn; if (drawn < 1f) { BackPlace(WearsModelSuit(rigOwner), out var offset, out var rotation2); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(0.66f, -0.3f, -0.05f); val4 = Vector3.Lerp(Vector3.Lerp(offset, val5, drawn), Vector3.Lerp(val5, val4, drawn), drawn); val3 = Quaternion.Slerp(rotation2, val3, drawn); } rotation = frame * val3; position = chest.position + frame * val4; } private void ViewPose(Transform view, float t, out Vector3 position, out Quaternion rotation) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //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_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00e8: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) Vector3 viewHead = ViewHead; Quaternion val = Quaternion.LookRotation(((Vector3)(ref viewHead)).normalized, ViewFront) * Liveliness(t); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(Plugin.ViewRight.Value, Plugin.ViewUp.Value, Plugin.ViewForward.Value); val2.y += Mathf.Abs(Mathf.Sin(Time.time * 7.5f)) * 0.008f * walk; float num = 1f - Drawn; if (num > 0f) { val2 += new Vector3(0.3f, -0.5f, -0.12f) * num; val = Quaternion.AngleAxis(-55f * num, Vector3.forward) * val; } rotation = view.rotation * val; position = view.position + view.rotation * val2; } private Vector3 PoseArms(Arm left, Arm right, Vector3 position, Quaternion rotation, Quaternion frame, PlayerControllerB player, float t, bool ownView) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) //IL_007b: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008e: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0183: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_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_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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (migh