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 ZZZ Remielle v1.0.0
RemielleSuit.dll
Decompiled 3 hours 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using ModelReplacement; using ModelReplacement.AvatarBodyUpdater; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace RemielleSuit; public enum AttentionKind { Player, Enemy, Item } public struct AttentionCandidate { public int Key; public AttentionKind Kind; public float Distance; public bool Speaking; public bool Eligible; public AttentionCandidate(int key, AttentionKind kind, float distance, bool speaking = true, bool eligible = true) { Key = key; Kind = kind; Distance = distance; Speaking = speaking; Eligible = eligible; } } public sealed class RemielleAttentionSelection { private float lastSpeech; private float selectedAt; public int CurrentKey { get; private set; } public bool HasTarget { get; private set; } public AttentionKind CurrentKind { get; private set; } public void Reset() { HasTarget = false; CurrentKey = 0; lastSpeech = (selectedAt = 0f); } public int Choose(IList<AttentionCandidate> candidates, float now, float pauseHold = 1.2f) { AttentionCandidate attentionCandidate = default(AttentionCandidate); AttentionCandidate c = default(AttentionCandidate); AttentionCandidate c2 = default(AttentionCandidate); bool flag = false; bool flag2 = false; bool flag3 = false; foreach (AttentionCandidate candidate in candidates) { if (!candidate.Eligible || float.IsNaN(candidate.Distance) || float.IsInfinity(candidate.Distance) || candidate.Distance < 0f) { continue; } if (HasTarget && candidate.Key == CurrentKey && candidate.Kind == CurrentKind) { attentionCandidate = candidate; flag = true; } if (candidate.Kind == AttentionKind.Player) { if (candidate.Speaking && (!flag2 || candidate.Distance < c.Distance)) { c = candidate; flag2 = true; } } else if (!flag3 || candidate.Kind < c2.Kind || (candidate.Kind == c2.Kind && candidate.Distance < c2.Distance)) { c2 = candidate; flag3 = true; } } if (flag && attentionCandidate.Kind == AttentionKind.Player && attentionCandidate.Speaking) { lastSpeech = now; } if (flag2) { if (flag && attentionCandidate.Kind == AttentionKind.Player && attentionCandidate.Speaking && (now - selectedAt < 0.65f || c.Distance >= attentionCandidate.Distance * 0.7f)) { return CurrentKey; } return Select(c, now); } if (flag && attentionCandidate.Kind == AttentionKind.Player && now - lastSpeech <= Mathf.Clamp(pauseHold, 0f, 5f)) { return CurrentKey; } if (flag3) { if (flag && attentionCandidate.Kind == c2.Kind && attentionCandidate.Kind != AttentionKind.Player && (now - selectedAt < 1.5f || c2.Distance >= attentionCandidate.Distance * 0.7f)) { return CurrentKey; } return Select(c2, now); } Reset(); return 0; } private int Select(AttentionCandidate c, float now) { if (!HasTarget || c.Key != CurrentKey || c.Kind != CurrentKind) { selectedAt = now; } HasTarget = true; CurrentKey = c.Key; CurrentKind = c.Kind; if (c.Kind == AttentionKind.Player && c.Speaking) { lastSpeech = now; } return CurrentKey; } public static bool InView(Vector3 origin, Vector3 forward, Vector3 point, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //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_0036: 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_0044: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.15f || magnitude > radius) { return false; } Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(forward, Vector3.up); if (Vector3.Angle(val2, val3) <= 65f) { return Mathf.Abs(Mathf.Atan2(val.y, ((Vector3)(ref val2)).magnitude) * 57.29578f) <= 60f; } return false; } public static bool ActiveSpeech(bool speaking, float amplitude) { if (speaking && !float.IsNaN(amplitude) && !float.IsInfinity(amplitude)) { return amplitude >= 0.002f; } return false; } public static bool Visible(Vector3 origin, Vector3 point, int mask, Transform observer, Transform model, Transform target, RaycastHit[] hits) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.05f) { return true; } int num = Physics.RaycastNonAlloc(origin, val / magnitude, hits, magnitude, mask, (QueryTriggerInteraction)1); if (num == hits.Length) { return false; } for (int i = 0; i < num; i++) { Transform transform = ((RaycastHit)(ref hits[i])).transform; if (Object.op_Implicit((Object)(object)transform) && (!Object.op_Implicit((Object)(object)observer) || !transform.IsChildOf(observer)) && (!Object.op_Implicit((Object)(object)model) || !transform.IsChildOf(model)) && (!Object.op_Implicit((Object)(object)target) || !transform.IsChildOf(target))) { return false; } } return true; } } public sealed class RemielleAttention { private readonly RemielleAttentionSelection selection = new RemielleAttentionSelection(); private readonly List<AttentionCandidate> candidates = new List<AttentionCandidate>(64); private readonly Dictionary<int, Object> objects = new Dictionary<int, Object>(); private readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[24]; private EnemyAI[] enemies = (EnemyAI[])(object)new EnemyAI[0]; private GrabbableObject[] items = (GrabbableObject[])(object)new GrabbableObject[0]; private Object target; private float nextScan; private float nextSceneScan; public void Reset() { selection.Reset(); target = null; nextScan = (nextSceneScan = 0f); } private static Vector3 Point(Object value) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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) PlayerControllerB val = (PlayerControllerB)(object)((value is PlayerControllerB) ? value : null); if (val != null) { if (!Object.op_Implicit((Object)(object)val.playerEye)) { return ((Component)val).transform.position + Vector3.up * 1.6f; } return val.playerEye.position; } EnemyAI val2 = (EnemyAI)(object)((value is EnemyAI) ? value : null); if (val2 != null) { if (!Object.op_Implicit((Object)(object)val2.eye)) { return ((Component)val2).transform.position + Vector3.up; } return val2.eye.position; } GrabbableObject val3 = (GrabbableObject)(object)((value is GrabbableObject) ? value : null); if (val3 != null) { Renderer componentInChildren = ((Component)val3).GetComponentInChildren<Renderer>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return ((Component)val3).transform.position; } Bounds bounds = componentInChildren.bounds; return ((Bounds)(ref bounds)).center; } return Vector3.zero; } private void Add(Component value, AttentionKind kind, Vector3 origin, Vector3 forward, float range, bool speaking, PlayerControllerB owner, Transform model) { //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) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Point((Object)(object)value); if (RemielleAttentionSelection.InView(origin, forward, val, range)) { int mask = (Object.op_Implicit((Object)(object)StartOfRound.Instance) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-5)); if (RemielleAttentionSelection.Visible(origin, val, mask, ((Component)owner).transform, model, value.transform, hits)) { int instanceID = ((Object)value).GetInstanceID(); objects[instanceID] = (Object)(object)value; candidates.Add(new AttentionCandidate(instanceID, kind, Vector3.Distance(origin, val), speaking)); } } } public bool Resolve(PlayerControllerB owner, Transform model, Vector3 origin, Vector3 forward, float now, out Vector3 direction) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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) direction = forward; if (!Object.op_Implicit((Object)(object)owner) || owner.isPlayerDead || !owner.isPlayerControlled || !Object.op_Implicit((Object)(object)StartOfRound.Instance)) { Reset(); return false; } if (now >= nextScan) { nextScan = now + 0.1f; candidates.Clear(); objects.Clear(); if (now >= nextSceneScan) { nextSceneScan = now + 1f; enemies = Object.FindObjectsOfType<EnemyAI>(); items = Object.FindObjectsOfType<GrabbableObject>(); } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val == (Object)(object)owner) && val.isPlayerControlled && !val.isPlayerDead && ((Component)val).gameObject.activeInHierarchy) { bool speaking = RemielleVoiceActivity.IsSpeaking(val); Add((Component)(object)val, AttentionKind.Player, origin, forward, Plugin.TalkingPlayersRange.Value, speaking, owner, model); } } EnemyAI[] array = enemies; foreach (EnemyAI val2 in array) { if (Object.op_Implicit((Object)(object)val2) && !val2.isEnemyDead && ((Behaviour)val2).isActiveAndEnabled) { Add((Component)(object)val2, AttentionKind.Enemy, origin, forward, Plugin.EnemiesRange.Value, speaking: false, owner, model); } } GrabbableObject[] array2 = items; foreach (GrabbableObject val3 in array2) { if (Object.op_Implicit((Object)(object)val3) && !val3.isHeld && !val3.isPocketed && !val3.isHeldByEnemy && ((Behaviour)val3).isActiveAndEnabled) { Add((Component)(object)val3, AttentionKind.Item, origin, forward, Plugin.ItemsRange.Value, speaking: false, owner, model); } } int key = selection.Choose(candidates, now, Plugin.SpeechPauseHold.Value); target = ((selection.HasTarget && objects.TryGetValue(key, out var value)) ? value : null); } if (!Object.op_Implicit(target)) { return false; } Object obj = target; PlayerControllerB val4 = (PlayerControllerB)(object)((obj is PlayerControllerB) ? obj : null); if (val4 == null || (val4.isPlayerControlled && !val4.isPlayerDead)) { Object obj2 = target; EnemyAI val5 = (EnemyAI)(object)((obj2 is EnemyAI) ? obj2 : null); if (val5 == null || !val5.isEnemyDead) { Object obj3 = target; GrabbableObject val6 = (GrabbableObject)(object)((obj3 is GrabbableObject) ? obj3 : null); if (val6 == null || (!val6.isHeld && !val6.isPocketed && !val6.isHeldByEnemy)) { direction = Point(target) - origin; return ((Vector3)(ref direction)).sqrMagnitude > 1E-06f; } } } target = null; selection.Reset(); nextScan = 0f; return false; } } internal static class RemielleVoiceActivity { private static Type commsType; private static object comms; private static readonly Dictionary<int, float> retry = new Dictionary<int, float>(); private static readonly Dictionary<int, object> states = new Dictionary<int, object>(); internal static bool IsSpeaking(PlayerControllerB player) { object obj = RemielleFace.Read(player, "voicePlayerState") ?? RemielleFace.Read(RemielleFace.Read(player, "currentVoiceChatIngameSettings"), "_playerState"); int instanceID = ((Object)player).GetInstanceID(); if (obj == null && states.TryGetValue(instanceID, out var value)) { obj = value; } if (obj == null && (!retry.TryGetValue(instanceID, out var value2) || Time.unscaledTime >= value2)) { retry[instanceID] = Time.unscaledTime + 1f; comms = RemielleFace.Read(StartOfRound.Instance, "voiceChatModule"); if (comms != null) { commsType = comms.GetType(); string text = (((NetworkBehaviour)player).IsOwner ? (RemielleFace.Read(comms, "LocalPlayerName") as string) : (RemielleFace.Read(player, "voicePlayerName") as string)); if (!string.IsNullOrEmpty(text)) { try { obj = commsType.GetMethod("FindPlayer", new Type[1] { typeof(string) })?.Invoke(comms, new object[1] { text }); if (obj != null) { states[instanceID] = obj; } } catch { } } } } object obj3 = RemielleFace.Read(obj, "IsSpeaking"); bool flag = default(bool); int num; if (obj3 is bool) { flag = (bool)obj3; num = 1; } else { num = 0; } bool flag2 = (byte)((uint)num & (flag ? 1u : 0u)) != 0; obj3 = RemielleFace.Read(obj, "IsConnected"); if (obj3 is bool && !(bool)obj3) { return false; } if (!(RemielleFace.Read(obj, "Amplitude") is float amplitude)) { return flag2; } return RemielleAttentionSelection.ActiveSpeech(flag2, amplitude); } } [DefaultExecutionOrder(310)] public class RemielleChainMotion : MonoBehaviour { private class Joint { public Transform Bone; public Quaternion Rest; public Quaternion PreviousParent; public Vector3 Offset; public Vector3 Velocity; public float Limit; public float Frequency; public float Response; public float Damping; public float Travel; public bool Dress; public bool Knot; public bool Ribbon; public bool Waist; public Vector3 LocalTip; public Vector3 TipPosition; public Vector3 TipVelocity; public Vector3 PreviousPivot; public Quaternion Applied; public Quaternion RibbonRest; public Transform RibbonAnchor; public float WholeLimit; public int Depth; } private readonly List<Joint> joints = new List<Joint>(); private readonly List<Joint> dressJoints = new List<Joint>(); private Transform pelvis; private Vector3 previousPelvis; private Quaternion previousPelvisRotation; private Vector3 previousPosition; private Vector3 filteredVelocity; private Quaternion previousRotation; private int lastFrame = -1; private bool initialized; public int DressJointCount => dressJoints.Count; public float MaxDressSwing { get; private set; } public float MaxDressTipSpeed { get; private set; } public float MaxRibbonTotalSwing { get; private set; } public int PinnedBowJointCount { get; private set; } private void Awake() { Initialize(); } private void Initialize() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: 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_01d0: 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_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_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_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: 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_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) if (initialized && Object.op_Implicit((Object)(object)pelvis) && joints.Count > 0 && dressJoints.Count > 0) { return; } initialized = true; joints.Clear(); dressJoints.Clear(); pelvis = null; lastFrame = -1; filteredVelocity = Vector3.zero; PinnedBowJointCount = 0; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(); Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform[] array = componentsInChildren; foreach (Transform val in array) { if (((Object)val).name.StartsWith("_cloth_tip_")) { dictionary[((Object)val).name.Substring(11)] = val; } if (((Object)val).name == "root.x") { pelvis = val; } } array = componentsInChildren; foreach (Transform val2 in array) { bool flag = ((Object)val2).name.StartsWith("Ctr_") && ((Object)val2).name.Contains("Hair"); bool flag2 = ((Object)val2).name.StartsWith("Skn_") && (((Object)val2).name.Contains("Skirt") || ((Object)val2).name.Contains("SwimTie")); bool flag3 = ((Object)val2).name.StartsWith("Skn_") && ((Object)val2).name.Contains("WingA_"); if (!Object.op_Implicit((Object)(object)val2.parent) || (!flag && !flag2 && !flag3)) { continue; } bool flag4 = flag3 && ((Object)val2).name.Contains("Yu"); Joint joint = new Joint { Bone = val2, Rest = val2.localRotation, PreviousParent = val2.parent.rotation, Applied = val2.localRotation, Dress = flag2, Limit = ((!flag3) ? (flag ? 20f : (((Object)val2).name.EndsWith("01") ? 12f : 24f)) : (flag4 ? 7f : (((Object)val2).name.EndsWith("01") ? 10f : 18f))), Frequency = ((!flag3) ? (flag ? 10f : 7f) : (flag4 ? 7f : 6f)), Response = (flag4 ? 0.035f : 0.1f), Damping = (flag3 ? 0.85f : (flag ? 1.05f : 0.8f)), Travel = (flag4 ? 4f : (flag3 ? 10f : 14f)) }; joints.Add(joint); if (!flag2) { continue; } if (dictionary.TryGetValue(((Object)val2).name, out var value)) { joint.LocalTip = val2.InverseTransformPoint(value.position); } else { foreach (Transform item in val2) { Transform val3 = item; if (IsDress(val3)) { joint.LocalTip = val3.localPosition; break; } } } if (((Vector3)(ref joint.LocalTip)).sqrMagnitude < 1E-12f) { Vector3 val4 = val2.parent.InverseTransformVector(val2.position - val2.parent.position); joint.LocalTip = Vector3.up * Mathf.Max(((Vector3)(ref val4)).magnitude, 0.0005f); } Transform parent = val2.parent; while (Object.op_Implicit((Object)(object)parent) && IsDress(parent)) { joint.Depth++; parent = parent.parent; } bool flag5 = ((Object)val2).name.Contains("SwimSkirt"); bool num = ((Object)val2).name.Contains("Tie"); joint.Limit = (flag5 ? 32f : Mathf.Min(18f + (float)joint.Depth * 5f, 34f)); joint.Frequency = (flag5 ? 8.2f : Mathf.Max(6.2f, 11f - (float)joint.Depth * 1.35f)); joint.Damping = (flag5 ? 0.48f : Mathf.Min(0.72f, 0.56f + (float)joint.Depth * 0.035f)); if (num) { joint.Limit = Mathf.Min(joint.Limit + 5f, 39f); joint.Frequency *= 0.85f; joint.Damping += 0.035f; } joint.Knot = IsBowKnot(val2); if (joint.Knot) { joint.Limit = 0f; PinnedBowJointCount++; } joint.Waist = ((Object)val2).name == "Skn_B_Skirt_01"; if (joint.Waist) { joint.Limit = 0f; } string text = RibbonBranch(val2); if (text != null) { joint.Ribbon = true; Transform val5 = val2; while (Object.op_Implicit((Object)(object)val5.parent) && RibbonBranch(val5.parent) == text) { val5 = val5.parent; } joint.RibbonAnchor = val5.parent; joint.RibbonRest = Quaternion.Inverse(joint.RibbonAnchor.rotation) * val2.rotation; bool flag6 = text.StartsWith("Long"); joint.WholeLimit = (flag6 ? 42f : 30f); if (!flag6) { int num2 = HierarchyDepth(val2) - HierarchyDepth(val5); joint.Limit = 12f + Mathf.Min((float)num2 * 6f, 12f); } } joint.TipPosition = val2.TransformPoint(joint.LocalTip); joint.PreviousPivot = val2.position; dressJoints.Add(joint); } dressJoints.Sort((Joint a, Joint b) => HierarchyDepth(a.Bone).CompareTo(HierarchyDepth(b.Bone))); if (!Object.op_Implicit((Object)(object)pelvis)) { pelvis = ((Component)this).transform; } previousPelvis = pelvis.position; previousPelvisRotation = pelvis.rotation; previousPosition = ((Component)this).transform.position; previousRotation = ((Component)this).transform.rotation; } private void LateUpdate() { Step(); } public void Step() { //IL_00bd: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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_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_0215: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_025a: 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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: 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_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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0307: 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_0322: 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_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: 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_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: 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_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) Initialize(); if (lastFrame == Time.frameCount) { foreach (Joint joint in joints) { if (Object.op_Implicit((Object)(object)joint.Bone)) { joint.Bone.localRotation = (joint.Dress ? joint.Applied : (joint.Rest * Quaternion.Euler(joint.Offset))); } } return; } bool flag = lastFrame < 0; lastFrame = Time.frameCount; float num = Mathf.Min(Time.deltaTime, 0.04f); if (num <= 0f) { return; } Vector3 val = ((Component)this).transform.position - previousPosition; bool flag2 = flag || ((Vector3)(ref val)).sqrMagnitude > 2.25f || Quaternion.Angle(previousRotation, ((Component)this).transform.rotation) > 80f; Vector3 val2 = (flag2 ? Vector3.zero : Vector3.ClampMagnitude(val / num, 4f)); filteredVelocity = Vector3.Lerp(filteredVelocity, val2, 1f - Mathf.Exp((0f - num) * 12f)); previousPosition = ((Component)this).transform.position; previousRotation = ((Component)this).transform.rotation; float num2 = default(float); Vector3 zero = default(Vector3); foreach (Joint joint2 in joints) { if (!joint2.Dress) { Quaternion rotation = joint2.Bone.parent.rotation; Quaternion val3 = Quaternion.Inverse(joint2.PreviousParent) * rotation; if (val3.w < 0f) { ((Quaternion)(ref val3))..ctor(0f - val3.x, 0f - val3.y, 0f - val3.z, 0f - val3.w); } ((Quaternion)(ref val3)).ToAngleAxis(ref num2, ref zero); if (num2 > 180f) { num2 -= 360f; } if (float.IsNaN(zero.x) || float.IsInfinity(zero.x)) { zero = Vector3.zero; } Vector3 val4 = joint2.Bone.parent.InverseTransformDirection(filteredVelocity); Vector3 val5 = Vector3.ClampMagnitude(-zero * (num2 / num) * joint2.Response + new Vector3(val4.z, 0f - val4.x, val4.x) * joint2.Travel, joint2.Limit); if (flag2) { joint2.Offset = Vector3.zero; joint2.Velocity = Vector3.zero; val5 = Vector3.zero; } int num3 = Mathf.Max(1, Mathf.CeilToInt(num / 0.008f)); float num4 = num / (float)num3; for (int i = 0; i < num3; i++) { joint2.Velocity += ((val5 - joint2.Offset) * joint2.Frequency * joint2.Frequency - joint2.Velocity * (joint2.Damping * joint2.Frequency)) * num4; joint2.Offset += joint2.Velocity * num4; } joint2.Offset = Vector3.ClampMagnitude(joint2.Offset, joint2.Limit); joint2.Bone.localRotation = joint2.Rest * Quaternion.Euler(joint2.Offset); joint2.PreviousParent = rotation; } } StepDress(flag); } private static bool IsDress(Transform bone) { if (Object.op_Implicit((Object)(object)bone) && ((Object)bone).name.StartsWith("Skn_")) { if (!((Object)bone).name.Contains("Skirt")) { return ((Object)bone).name.Contains("SwimTie"); } return true; } return false; } private static int TieIndex(Transform bone) { string name = ((Object)bone).name; int num = name.LastIndexOf('_'); if (num < 0 || !int.TryParse(name.Substring(num + 1).Split('.')[0], out var result)) { return -1; } return result; } private static bool IsBowKnot(Transform bone) { int num = TieIndex(bone); if ((((Object)bone).name.StartsWith("Skn_SkirtTie_") || ((Object)bone).name.StartsWith("Skn_Pas_SwimTie_")) && num >= 1) { return num <= 3; } return false; } private static string RibbonBranch(Transform bone) { if (!Object.op_Implicit((Object)(object)bone)) { return null; } string name = ((Object)bone).name; if (name.StartsWith("Skn_Ori_L_SkirtC_")) { return "LongLeft"; } if (name.StartsWith("Skn_Ori_R_SkirtC_")) { return "LongRight"; } int num = TieIndex(bone); if (name.StartsWith("Skn_SkirtTie_")) { switch (num) { case 4: case 5: return "BowLeft"; case 6: case 7: return "BowRight"; } } if (name.StartsWith("Skn_Pas_SwimTie_")) { if (num >= 5 && num <= 7) { return "SwimLeft"; } if (num == 8 || num == 9) { return "SwimRight"; } } return null; } private static int HierarchyDepth(Transform bone) { int num = 0; while (Object.op_Implicit((Object)(object)bone.parent)) { num++; bone = bone.parent; } return num; } private static bool Finite(Vector3 v) { //IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(v.x) && !float.IsNaN(v.y) && !float.IsNaN(v.z) && !float.IsInfinity(v.x) && !float.IsInfinity(v.y)) { return !float.IsInfinity(v.z); } return false; } private static Quaternion SwingBetween(Vector3 from, Vector3 to) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0027: 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_0029: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.Cross(from, to); float num = Mathf.Clamp(Vector3.Dot(from, to), -1f, 1f); if (num < -0.9999f) { return Quaternion.FromToRotation(from, to); } Quaternion val2 = default(Quaternion); ((Quaternion)(ref val2))..ctor(val.x, val.y, val.z, 1f + num); float num2 = 1f / Mathf.Sqrt(val2.x * val2.x + val2.y * val2.y + val2.z * val2.z + val2.w * val2.w); return new Quaternion(val2.x * num2, val2.y * num2, val2.z * num2, val2.w * num2); } private void StepDress(bool first) { //IL_0042: 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_0052: 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_0090: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00b1: 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_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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_021c: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: 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_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: 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_02c8: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_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_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 (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pelvis)) { Initialize(); if (!Object.op_Implicit((Object)(object)pelvis)) { return; } } float deltaTime = Time.deltaTime; if (deltaTime <= 0f) { return; } float num = Mathf.Min(deltaTime, 0.067f); Vector3 val = pelvis.position - previousPelvis; bool flag = first || deltaTime > 0.15f || ((Vector3)(ref val)).sqrMagnitude > 2.25f || Quaternion.Angle(previousPelvisRotation, pelvis.rotation) > 110f; Vector3 val2 = (flag ? Vector3.zero : Vector3.ClampMagnitude(val / num, 10f)); previousPelvis = pelvis.position; previousPelvisRotation = pelvis.rotation; MaxDressSwing = 0f; MaxDressTipSpeed = 0f; MaxRibbonTotalSwing = 0f; foreach (Joint dressJoint in dressJoints) { if (!Object.op_Implicit((Object)(object)dressJoint.Bone) || !Object.op_Implicit((Object)(object)dressJoint.Bone.parent)) { continue; } Transform bone = dressJoint.Bone; Transform parent = bone.parent; if (dressJoint.Knot || dressJoint.Waist) { bone.localRotation = dressJoint.Rest; dressJoint.Applied = dressJoint.Rest; dressJoint.PreviousPivot = bone.position; dressJoint.TipPosition = bone.TransformPoint(dressJoint.LocalTip); dressJoint.TipVelocity = Vector3.zero; continue; } Vector3 position = bone.position; Vector3 val3 = parent.TransformVector(dressJoint.Rest * Vector3.Scale(dressJoint.LocalTip, bone.localScale)); float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude < 1E-06f) { continue; } Vector3 val4 = val3 / magnitude; Quaternion val5 = (dressJoint.Ribbon ? (dressJoint.RibbonAnchor.rotation * dressJoint.RibbonRest) : Quaternion.identity); Vector3 val6; Vector3 val7; if (!dressJoint.Ribbon) { val6 = val4; } else { val7 = val5 * ((Vector3)(ref dressJoint.LocalTip)).normalized; val6 = ((Vector3)(ref val7)).normalized; } Vector3 val8 = val6; if (!flag && Finite(dressJoint.TipPosition) && Finite(dressJoint.TipVelocity)) { val7 = position - dressJoint.PreviousPivot; if (!(((Vector3)(ref val7)).sqrMagnitude > 2.25f)) { goto IL_02ab; } } dressJoint.TipPosition = position + val3; dressJoint.TipVelocity = Vector3.zero; dressJoint.PreviousPivot = position; goto IL_02ab; IL_02ab: Vector3 previousPivot = dressJoint.PreviousPivot; Vector3 val9 = Vector3.ClampMagnitude((position - previousPivot) / num, 12f); int num2 = Mathf.Max(1, Mathf.CeilToInt(num / 0.005f)); float num3 = num / (float)num2; for (int i = 0; i < num2; i++) { Vector3 val10 = Vector3.Lerp(previousPivot, position, ((float)i + 1f) / (float)num2); Vector3 val11 = (val10 + val3 - dressJoint.TipPosition) * (dressJoint.Frequency * dressJoint.Frequency) - (dressJoint.TipVelocity - val9) * (2f * dressJoint.Damping * dressJoint.Frequency) - val2 * (magnitude * dressJoint.Frequency * 0.11f); dressJoint.TipVelocity += val11 * num3; dressJoint.TipPosition += dressJoint.TipVelocity * num3; Vector3 val12 = dressJoint.TipPosition - val10; Vector3 val13 = ((((Vector3)(ref val12)).sqrMagnitude > 1E-12f) ? ((Vector3)(ref val12)).normalized : val4); bool flag2 = Vector3.Angle(val4, val13) > dressJoint.Limit; if (flag2) { val7 = Vector3.RotateTowards(val4, val13, dressJoint.Limit * ((float)Math.PI / 180f), 0f); val13 = ((Vector3)(ref val7)).normalized; } bool flag3 = false; if (dressJoint.Ribbon) { for (int j = 0; j < 3; j++) { if (Vector3.Angle(val8, val13) > dressJoint.WholeLimit) { val7 = Vector3.RotateTowards(val8, val13, dressJoint.WholeLimit * ((float)Math.PI / 180f), 0f); val13 = ((Vector3)(ref val7)).normalized; flag3 = true; } if (Vector3.Angle(val4, val13) > dressJoint.Limit) { val7 = Vector3.RotateTowards(val4, val13, dressJoint.Limit * ((float)Math.PI / 180f), 0f); val13 = ((Vector3)(ref val7)).normalized; flag2 = true; } } } dressJoint.TipPosition = val10 + val13 * magnitude; Vector3 val14 = Vector3.ProjectOnPlane(dressJoint.TipVelocity - val9, val13); if (flag2) { val7 = Vector3.ProjectOnPlane(-val4, val13); Vector3 normalized = ((Vector3)(ref val7)).normalized; float num4 = Vector3.Dot(val14, normalized); if (num4 > 0f) { val14 -= normalized * num4; } } if (flag3) { val7 = Vector3.ProjectOnPlane(-val8, val13); Vector3 normalized2 = ((Vector3)(ref val7)).normalized; float num5 = Vector3.Dot(val14, normalized2); if (num5 > 0f) { val14 -= normalized2 * num5; } } val14 = Vector3.ClampMagnitude(val14, magnitude * 12f); dressJoint.TipVelocity = val9 + val14; } val7 = dressJoint.TipPosition - position; Vector3 normalized3 = ((Vector3)(ref val7)).normalized; Quaternion val15 = SwingBetween(dressJoint.Ribbon ? val8 : val4, normalized3); bone.rotation = val15 * (dressJoint.Ribbon ? val5 : (parent.rotation * dressJoint.Rest)); dressJoint.Applied = bone.localRotation; dressJoint.PreviousPivot = position; MaxDressSwing = Mathf.Max(MaxDressSwing, Vector3.Angle(val4, normalized3)); float maxDressTipSpeed = MaxDressTipSpeed; val7 = dressJoint.TipVelocity - val9; MaxDressTipSpeed = Mathf.Max(maxDressTipSpeed, ((Vector3)(ref val7)).magnitude); if (dressJoint.Ribbon) { MaxRibbonTotalSwing = Mathf.Max(MaxRibbonTotalSwing, Vector3.Angle(val8, normalized3)); } } } public void ResetDressMotion() { //IL_0030: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Initialize(); foreach (Joint dressJoint in dressJoints) { if (Object.op_Implicit((Object)(object)dressJoint.Bone)) { dressJoint.Bone.localRotation = dressJoint.Rest; dressJoint.Applied = dressJoint.Rest; dressJoint.TipPosition = dressJoint.Bone.TransformPoint(dressJoint.LocalTip); dressJoint.TipVelocity = Vector3.zero; dressJoint.PreviousPivot = dressJoint.Bone.position; } } previousPelvis = pelvis.position; previousPelvisRotation = pelvis.rotation; MaxDressSwing = 0f; MaxDressTipSpeed = 0f; MaxRibbonTotalSwing = 0f; } private void OnDisable() { //IL_0031: 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_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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) lastFrame = -1; foreach (Joint joint in joints) { if (Object.op_Implicit((Object)(object)joint.Bone)) { joint.Bone.localRotation = joint.Rest; joint.Applied = joint.Rest; joint.Offset = Vector3.zero; joint.Velocity = Vector3.zero; joint.TipVelocity = Vector3.zero; } } } } public class RemielleFootAlignment : MonoBehaviour { private Transform hip; private Transform leftSole; private Transform rightSole; private Transform playerLeft; private Transform playerRight; private Vector3 leftReference; private Vector3 rightReference; private SkinnedMeshRenderer source; private bool ready; public float LastCorrection { get; private set; } public void Align(SkinnedMeshRenderer player) { //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_025a: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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) if (!Object.op_Implicit((Object)(object)player)) { return; } if (!ready || (Object)(object)source != (Object)(object)player) { source = player; Animator component = ((Component)this).GetComponent<Animator>(); if (!Object.op_Implicit((Object)(object)component) || !component.isHuman) { return; } hip = component.GetBoneTransform((HumanBodyBones)0); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); leftSole = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "RemielleSole.L")); rightSole = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "RemielleSole.R")); Transform val = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "EmployeeSoleReference.L")); Transform val2 = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "EmployeeSoleReference.R")); playerLeft = ((IEnumerable<Transform>)player.bones).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "foot.L")); playerRight = ((IEnumerable<Transform>)player.bones).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "foot.R")); ready = Object.op_Implicit((Object)(object)hip) && Object.op_Implicit((Object)(object)leftSole) && Object.op_Implicit((Object)(object)rightSole) && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)playerLeft) && Object.op_Implicit((Object)(object)playerRight); if (!ready) { return; } leftReference = val.localPosition; rightReference = val2.localPosition; } float num = Mathf.Min(playerLeft.TransformPoint(leftReference).y, playerRight.TransformPoint(rightReference).y); float num2 = Mathf.Min(leftSole.position.y, rightSole.position.y); LastCorrection = num - num2; if (!float.IsNaN(LastCorrection) && !float.IsInfinity(LastCorrection)) { Transform obj = hip; obj.position += Vector3.up * LastCorrection; } } } public static class RemielleFootAlignmentPatch { public static void Install(Harmony h) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown h.Patch((MethodBase)AccessTools.Method(typeof(AvatarUpdater), "UpdateModel", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(RemielleFootAlignmentPatch), "AfterPose", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void AfterPose(GameObject ___replacement, SkinnedMeshRenderer ___playerModelRenderer) { if (Object.op_Implicit((Object)(object)___replacement) && ((Object)___replacement).name.StartsWith("Remielle_", StringComparison.Ordinal)) { RemielleFootAlignment remielleFootAlignment = ___replacement.GetComponent<RemielleFootAlignment>(); if (!Object.op_Implicit((Object)(object)remielleFootAlignment)) { remielleFootAlignment = ___replacement.AddComponent<RemielleFootAlignment>(); } remielleFootAlignment.Align(___playerModelRenderer); ___replacement.GetComponent<RemielleHeadTracking>()?.Step(); ___replacement.GetComponent<RemielleSecondaryMotion>()?.Step(); ___replacement.GetComponent<RemielleChainMotion>()?.Step(); ___replacement.GetComponent<RemielleGarmentFit>()?.Step(); } } } [DefaultExecutionOrder(330)] public class RemielleGarmentFit : MonoBehaviour { private struct Shape { public SkinnedMeshRenderer Renderer; public int Index; } private readonly List<Shape> shapes = new List<Shape>(); private Transform hip; private Transform thigh; private Transform knee; private Vector3 reference; private void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Animator component = ((Component)this).GetComponent<Animator>(); if (!Object.op_Implicit((Object)(object)component) || !component.isHuman) { return; } hip = component.GetBoneTransform((HumanBodyBones)0); thigh = component.GetBoneTransform((HumanBodyBones)1); knee = component.GetBoneTransform((HumanBodyBones)3); reference = Direction(); SkinnedMeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val in componentsInChildren) { for (int j = 0; j < val.sharedMesh.blendShapeCount; j++) { if (val.sharedMesh.GetBlendShapeName(j).EndsWith("RemielleFit_LeftHip")) { shapes.Add(new Shape { Renderer = val, Index = j }); } } } } private Vector3 Direction() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) Vector3 val = hip.InverseTransformDirection(knee.position - thigh.position); return ((Vector3)(ref val)).normalized; } private void LateUpdate() { Step(); } public void Step() { //IL_0029: 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) if (!Object.op_Implicit((Object)(object)hip) || !Object.op_Implicit((Object)(object)thigh) || !Object.op_Implicit((Object)(object)knee)) { return; } float num = Vector3.Angle(reference, Direction()); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(60f, 105f, num)) * 100f; foreach (Shape shape in shapes) { shape.Renderer.SetBlendShapeWeight(shape.Index, num2); } } } [DefaultExecutionOrder(200)] public class RemielleHeadTracking : MonoBehaviour { public PlayerControllerB Player; private readonly RemielleAttention attention = new RemielleAttention(); public Quaternion? WorldAimFrame; public bool TrackingEnabled = true; private Transform neck; private Transform head; private Quaternion headToLook; private Quaternion neckBase; private Quaternion headBase; private Quaternion neckApplied; private Quaternion headApplied; private Quaternion neutralNeck; private Quaternion neutralHead; private bool ready; private bool applied; private int previousFrame = int.MinValue; private float yaw; private float pitch; private float aimWeight; public const float MaximumYaw = 50f; public const float MaximumUpPitch = 35f; public const float MaximumDownPitch = 45f; public const float MaximumCorrection = 55f; public const float NeckShare = 0.3f; public bool HasAttentionTarget { get; private set; } public Vector3 AttentionDirection { get; private set; } public float CurrentYaw => yaw; public float CurrentPitch => pitch; public float LastCorrectionAngle { get; private set; } public bool Ready => ready; public Vector3 LookForward { get { //IL_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!ready) { return ((Component)this).transform.forward; } return head.rotation * headToLook * Vector3.forward; } } public Vector3 LookUp { get { //IL_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!ready) { return ((Component)this).transform.up; } return head.rotation * headToLook * Vector3.up; } } private void Awake() { Initialize(); } private void Initialize() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_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) //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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00f9: Unknown result type (might be due to invalid IL or missing references) if (!ready) { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); neck = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "neck.x")); head = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "head.x")); ready = Object.op_Implicit((Object)(object)neck) && Object.op_Implicit((Object)(object)head) && head.IsChildOf(neck); if (ready) { headToLook = Quaternion.Inverse(head.rotation) * ((Component)this).transform.rotation; neckBase = (neutralNeck = neck.localRotation); headBase = (neutralHead = head.localRotation); } } } private static bool Finite(float value) { if (!float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } private static bool Finite(Vector3 value) { //IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (Finite(value.x) && Finite(value.y)) { return Finite(value.z); } return false; } private static bool SameRotation(Quaternion a, Quaternion b) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) float num = ((!(Quaternion.Dot(a, b) < 0f)) ? 1 : (-1)); float num2 = a.x - num * b.x; float num3 = a.y - num * b.y; float num4 = a.z - num * b.z; float num5 = a.w - num * b.w; return num2 * num2 + num3 * num3 + num4 * num4 + num5 * num5 < 1E-09f; } private void RestoreAppliedPose() { //IL_0017: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0059: Unknown result type (might be due to invalid IL or missing references) if (ready && applied) { if (SameRotation(neck.localRotation, neckApplied)) { neck.localRotation = neckBase; } if (SameRotation(head.localRotation, headApplied)) { head.localRotation = headBase; } applied = false; } } public void StepFromDirection(Vector3 direction, float deltaTime, int frameToken, bool tracking = true) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: 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_0074: 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_00ac: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_01d8: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_01f5: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_025a: 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_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) Initialize(); if (!ready) { return; } RestoreAppliedPose(); neckBase = neck.localRotation; headBase = head.localRotation; bool flag = tracking && TrackingEnabled && Finite(direction) && ((Vector3)(ref direction)).sqrMagnitude > 1E-08f; Quaternion val = (Quaternion)(((??)WorldAimFrame) ?? ((Component)this).transform.rotation); if (previousFrame != frameToken) { previousFrame = frameToken; float num = yaw; float num2 = pitch; if (flag) { Vector3 val2 = Quaternion.Inverse(val) * ((Vector3)(ref direction)).normalized; num = Mathf.Clamp(Mathf.Atan2(val2.x, val2.z) * 57.29578f, -50f, 50f); num2 = Mathf.Clamp(Mathf.Atan2(val2.y, Mathf.Sqrt(val2.x * val2.x + val2.z * val2.z)) * 57.29578f, -45f, 35f); } float num3 = 1f - Mathf.Exp((0f - Mathf.Clamp(deltaTime, 0f, 0.1f)) * 10f); yaw = Mathf.Lerp(yaw, num, num3); pitch = Mathf.Lerp(pitch, num2, num3); aimWeight = Mathf.Lerp(aimWeight, (float)(flag ? 1 : 0), num3); } LastCorrectionAngle = 0f; if (TrackingEnabled && !(aimWeight < 1E-06f)) { Vector3 val3 = val * Quaternion.Euler(0f - pitch, yaw, 0f) * Vector3.forward; Quaternion val4 = Quaternion.FromToRotation(LookForward, val3); val4 = Quaternion.RotateTowards(Quaternion.identity, val4, 55f); val4 = Quaternion.Slerp(Quaternion.identity, val4, aimWeight); LastCorrectionAngle = Quaternion.Angle(Quaternion.identity, val4); neck.rotation = Quaternion.Slerp(Quaternion.identity, val4, 0.3f) * neck.rotation; head.rotation = Quaternion.Slerp(Quaternion.identity, val4, 0.7f) * head.rotation; neckApplied = neck.localRotation; headApplied = head.localRotation; applied = true; } } public void Step() { //IL_006b: 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_0090: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00d4: 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) TrackingEnabled = Plugin.HeadTracking.Value; bool flag = Object.op_Implicit((Object)(object)Player) && TrackingEnabled && !Player.isPlayerDead && Player.isPlayerControlled; Initialize(); WorldAimFrame = (Object.op_Implicit((Object)(object)Player) ? new Quaternion?(((Component)Player).transform.rotation) : ((Quaternion?)null)); Vector3 val = (Quaternion)(((??)WorldAimFrame) ?? ((Component)this).transform.rotation) * Vector3.forward; Vector3 direction = val; HasAttentionTarget = flag && ready && attention.Resolve(Player, ((Component)this).transform, head.position, val, Time.unscaledTime, out direction); AttentionDirection = direction; if (!flag) { attention.Reset(); } if (flag) { PrepareNeutralTrackingPose(); } StepFromDirection(direction, Time.deltaTime, Time.frameCount, HasAttentionTarget); } public void PrepareNeutralTrackingPose() { //IL_001c: 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) Initialize(); if (ready) { RestoreAppliedPose(); neck.localRotation = neutralNeck; head.localRotation = neutralHead; } } private void LateUpdate() { Step(); } public void ResetAim() { RestoreAppliedPose(); yaw = (pitch = (aimWeight = 0f)); previousFrame = int.MinValue; LastCorrectionAngle = 0f; HasAttentionTarget = false; attention.Reset(); } private void OnDisable() { ResetAim(); } } public sealed class RemielleCameraHeightOffset { private struct Shift { public Transform Target; public Transform Parent; public Vector3 BaseLocal; public Vector3 WrittenLocal; } public const float AddedHeight = 0.1f; private readonly List<Shift> shifts = new List<Shift>(); private readonly List<Transform> targets = new List<Transform>(); public int ShiftedTransformCount => shifts.Count; public void Restore() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) foreach (Shift shift in shifts) { if (Object.op_Implicit((Object)(object)shift.Target) && (Object)(object)shift.Target.parent == (Object)(object)shift.Parent) { Vector3 val = shift.Target.localPosition - shift.WrittenLocal; if (((Vector3)(ref val)).sqrMagnitude < 1E-10f) { shift.Target.localPosition = shift.BaseLocal; } } } shifts.Clear(); } public void Apply(bool active, params Transform[] candidates) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00eb: 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_00fb: 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_010f: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) Restore(); targets.Clear(); if (!active) { return; } foreach (Transform val in candidates) { if (!Object.op_Implicit((Object)(object)val) || targets.Contains(val)) { continue; } bool flag = false; foreach (Transform val2 in candidates) { if (Object.op_Implicit((Object)(object)val2) && (Object)(object)val2 != (Object)(object)val && val.IsChildOf(val2)) { flag = true; break; } } if (!flag) { targets.Add(val); } } foreach (Transform target in targets) { Transform parent = target.parent; Vector3 localPosition = target.localPosition; Vector3 val3 = (Object.op_Implicit((Object)(object)parent) ? parent.InverseTransformVector(Vector3.up * 0.1f) : (Vector3.up * 0.1f)); if (!float.IsNaN(val3.y) && !float.IsInfinity(val3.y)) { target.localPosition = localPosition + val3; shifts.Add(new Shift { Target = target, Parent = parent, BaseLocal = localPosition, WrittenLocal = target.localPosition }); } } } } public sealed class RemiellePlayerHeight : MonoBehaviour { private PlayerControllerB player; private BodyReplacementBase body; private GameObject model; private readonly RemielleCameraHeightOffset offset = new RemielleCameraHeightOffset(); private readonly Transform[] targets = (Transform[])(object)new Transform[3]; private static readonly HashSet<RemiellePlayerHeight> instances = new HashSet<RemiellePlayerHeight>(); private bool IsActive { get { if (Object.op_Implicit((Object)(object)player) && ((NetworkBehaviour)player).IsOwner && player.isPlayerControlled && !player.isPlayerDead && !player.isFreeCamera && Object.op_Implicit((Object)(object)player.gameplayCamera) && ((Behaviour)player.gameplayCamera).enabled && ((Component)player.gameplayCamera).gameObject.activeInHierarchy && Object.op_Implicit((Object)(object)body) && ((Behaviour)body).isActiveAndEnabled && body.IsActive && Object.op_Implicit((Object)(object)model)) { return model.activeInHierarchy; } return false; } } public static void Attach(PlayerControllerB player, BodyReplacementBase body, GameObject model) { if (Object.op_Implicit((Object)(object)player) && ((NetworkBehaviour)player).IsOwner && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)model)) { RemiellePlayerHeight remiellePlayerHeight = ((Component)player).GetComponent<RemiellePlayerHeight>(); if (!Object.op_Implicit((Object)(object)remiellePlayerHeight)) { remiellePlayerHeight = ((Component)player).gameObject.AddComponent<RemiellePlayerHeight>(); } remiellePlayerHeight.offset.Restore(); remiellePlayerHeight.player = player; remiellePlayerHeight.body = body; remiellePlayerHeight.model = model; instances.Add(remiellePlayerHeight); RemielleHeightBinding remielleHeightBinding = model.AddComponent<RemielleHeightBinding>(); remielleHeightBinding.Owner = remiellePlayerHeight; remielleHeightBinding.Model = model; } } public void Restore() { offset.Restore(); } public void Apply() { if (!IsActive) { offset.Restore(); return; } Transform val = (Object.op_Implicit((Object)(object)player.cameraContainerTransform) ? player.cameraContainerTransform : ((Component)player.gameplayCamera).transform); targets[0] = val; targets[1] = player.localArmsTransform; targets[2] = player.localVisor; offset.Apply(active: true, targets); } internal void Release(GameObject releasedModel) { if (!((Object)(object)model != (Object)(object)releasedModel)) { offset.Restore(); body = null; model = null; } } internal void Suspend(GameObject suspendedModel) { if ((Object)(object)model == (Object)(object)suspendedModel) { offset.Restore(); } } private void Update() { if (!IsActive) { offset.Restore(); } } private void OnDisable() { offset.Restore(); } private void OnDestroy() { offset.Restore(); instances.Remove(this); } public static void RestoreAll() { foreach (RemiellePlayerHeight instance in instances) { if (Object.op_Implicit((Object)(object)instance)) { instance.offset.Restore(); } } } public static void Install(Harmony harmony) { //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_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_0076: Expected O, but got Unknown //IL_0076: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown string[] array = new string[2] { "Update", "LateUpdate" }; foreach (string text in array) { harmony.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), text, (Type[])null, (Type[])null), new HarmonyMethod(typeof(RemiellePlayerHeight), "BeforePose", (Type[])null) { priority = 800 }, new HarmonyMethod(typeof(RemiellePlayerHeight), "AfterPose", (Type[])null) { priority = 0 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } array = new string[5] { "KillPlayer", "OnDisable", "OnDestroy", "SpawnPlayerAnimation", "TeleportPlayer" }; foreach (string text2 in array) { harmony.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), text2, (Type[])null, (Type[])null), new HarmonyMethod(typeof(RemiellePlayerHeight), "BeforePose", (Type[])null) { priority = 800 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } harmony.Patch((MethodBase)AccessTools.Method(typeof(BodyReplacementBase), "OnDestroy", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RemiellePlayerHeight), "BeforeBodyRemoved", (Type[])null) { priority = 800 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void BeforePose(PlayerControllerB __instance) { if (Object.op_Implicit((Object)(object)__instance)) { ((Component)__instance).GetComponent<RemiellePlayerHeight>()?.Restore(); } } private static void AfterPose(PlayerControllerB __instance) { if (Object.op_Implicit((Object)(object)__instance)) { ((Component)__instance).GetComponent<RemiellePlayerHeight>()?.Apply(); } } private static void BeforeBodyRemoved(BodyReplacementBase __instance) { if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)__instance.controller)) { RemiellePlayerHeight component = ((Component)__instance.controller).GetComponent<RemiellePlayerHeight>(); if (Object.op_Implicit((Object)(object)component) && (Object)(object)component.body == (Object)(object)__instance) { component.offset.Restore(); component.body = null; component.model = null; } } } } public sealed class RemielleHeightBinding : MonoBehaviour { internal RemiellePlayerHeight Owner; internal GameObject Model; private void OnDisable() { if (Object.op_Implicit((Object)(object)Owner)) { Owner.Suspend(Model); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)Owner)) { Owner.Release(Model); } } } [DefaultExecutionOrder(300)] public class RemielleSecondaryMotion : MonoBehaviour { private class Spring { public Transform Bone; public Vector3 Rest; public Vector3 Position; public Vector3 Velocity; public Vector3 Previous; public Quaternion Rotation; public float Limit; public float Omega; public float Damping; public bool Breast; public Vector3 SupportUp; public Vector3 SupportRight; public Vector3 SupportForward; public Vector3 AppliedPosition; public Quaternion AppliedRotation; public Quaternion