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 CompanyGym v1.1.3
plugins/CompanyGym/CompanyGym.dll
Decompiled 14 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.LowLevel; using UnityEngine.PlayerLoop; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Company Gym")] [assembly: AssemblyDescription("Outdoor gym, fixed arithmetic challenges and four muscular physique levels for Lethal Company.")] [assembly: AssemblyFileVersion("1.1.3.0")] [assembly: InternalsVisibleTo("CompanyGymQa")] [assembly: AssemblyVersion("1.1.3.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CompanyGym { internal static class GymAnimationLoop { internal static bool Ensure(UpdateFunction update) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) PlayerLoopSystem system = PlayerLoop.GetCurrentPlayerLoop(); if (Contains(system)) { return true; } if (!Insert(ref system, update)) { return false; } PlayerLoop.SetPlayerLoop(system); return true; } private static bool Contains(PlayerLoopSystem system) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (system.type == typeof(GymAnimationLoop)) { return true; } if (system.subSystemList != null) { PlayerLoopSystem[] subSystemList = system.subSystemList; for (int i = 0; i < subSystemList.Length; i++) { if (Contains(subSystemList[i])) { return true; } } } return false; } private static bool Insert(ref PlayerLoopSystem system, UpdateFunction update) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (system.type == typeof(PreLateUpdate)) { PlayerLoopSystem[] array = (PlayerLoopSystem[])(((object)system.subSystemList) ?? ((object)new PlayerLoopSystem[0])); Array.Resize(ref array, array.Length + 1); array[^1] = new PlayerLoopSystem { type = typeof(GymAnimationLoop), updateDelegate = update }; system.subSystemList = array; return true; } if (system.subSystemList == null) { return false; } for (int i = 0; i < system.subSystemList.Length; i++) { if (Insert(ref system.subSystemList[i], update)) { return true; } } return false; } internal static void Remove() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) PlayerLoopSystem system = PlayerLoop.GetCurrentPlayerLoop(); RemoveFrom(ref system); PlayerLoop.SetPlayerLoop(system); } private static void RemoveFrom(ref PlayerLoopSystem system) { //IL_0035: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (system.subSystemList == null) { return; } PlayerLoopSystem[] array = system.subSystemList; int num = 0; for (int i = 0; i < array.Length; i++) { if (!(array[i].type == typeof(GymAnimationLoop))) { PlayerLoopSystem system2 = array[i]; RemoveFrom(ref system2); array[num++] = system2; } } if (num != array.Length) { Array.Resize(ref array, num); } system.subSystemList = array; } } internal sealed class GymAppearance : IDisposable { private sealed class Skin { internal SkinnedMeshRenderer Renderer; internal Mesh Original; internal Mesh[] Muscles; internal Bounds Bounds; internal bool RenderFlagsApplied; internal bool OriginalOffscreen; internal bool OriginalRecalculation; } private struct BoneFrame { internal Transform Bone; internal Vector3 Position; internal Vector3 Scale; internal Quaternion Rotation; } internal readonly PlayerControllerB Player; private readonly List<Skin> skins = new List<Skin>(); private readonly Dictionary<string, Transform> bones = new Dictionary<string, Transform>(StringComparer.Ordinal); private readonly List<BoneFrame> frame = new List<BoneFrame>(); private readonly List<BoneFrame> neutral = new List<BoneFrame>(); private readonly Dictionary<Transform, Quaternion> exerciseFeet = new Dictionary<Transform, Quaternion>(); private readonly Dictionary<Transform, Matrix4x4> bindCharacter = new Dictionary<Transform, Matrix4x4>(); private readonly Transform[] orderedBones; private readonly Vector3[] posePositions; private readonly Quaternion[] poseRotations; private static readonly string[] Sides = new string[2] { "L", "R" }; private bool frameApplied; private float nextCosmetics; private Transform[] cosmetics = (Transform[])(object)new Transform[0]; internal float GripError { get; private set; } internal float FootError { get; private set; } internal int MeshCount => skins.Count((Skin s) => s.Muscles != null); internal void RefreshCosmetics() { nextCosmetics = 0f; } internal GymAppearance(PlayerControllerB player) { //IL_00e8: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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_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_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) Player = player; SkinnedMeshRenderer thisPlayerModel = player.thisPlayerModel; Transform[] array = ((Object.op_Implicit((Object)(object)thisPlayerModel) && Object.op_Implicit((Object)(object)thisPlayerModel.sharedMesh)) ? thisPlayerModel.bones : Array.Empty<Transform>()); if (Object.op_Implicit((Object)(object)thisPlayerModel) && Object.op_Implicit((Object)(object)thisPlayerModel.sharedMesh)) { Matrix4x4[] bindposes = thisPlayerModel.sharedMesh.bindposes; for (int i = 0; i < array.Length; i++) { Transform val = array[i]; if (Object.op_Implicit((Object)(object)val)) { bones[((Object)val).name] = val; if (i < bindposes.Length) { bindCharacter[val] = ((Component)player).transform.worldToLocalMatrix * ((Component)thisPlayerModel).transform.localToWorldMatrix * ((Matrix4x4)(ref bindposes[i])).inverse; } } } } orderedBones = bones.Values.OrderBy(Depth).ToArray(); posePositions = (Vector3[])(object)new Vector3[orderedBones.Length]; poseRotations = (Quaternion[])(object)new Quaternion[orderedBones.Length]; if (Object.op_Implicit((Object)(object)thisPlayerModel) && Object.op_Implicit((Object)(object)thisPlayerModel.sharedMesh)) { Dictionary<Transform, int> dictionary = new Dictionary<Transform, int>(); for (int j = 0; j < array.Length; j++) { if (Object.op_Implicit((Object)(object)array[j])) { dictionary[array[j]] = j; } } Matrix4x4[] bindposes2 = thisPlayerModel.sharedMesh.bindposes; Transform[] array2 = orderedBones; foreach (Transform val2 in array2) { if (Object.op_Implicit((Object)(object)val2.parent) && dictionary.TryGetValue(val2.parent, out var value) && dictionary.TryGetValue(val2, out var value2) && value < bindposes2.Length && value2 < bindposes2.Length) { Matrix4x4 val3 = bindposes2[value] * ((Matrix4x4)(ref bindposes2[value2])).inverse; neutral.Add(new BoneFrame { Bone = val2, Position = Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(3)), Rotation = ((Matrix4x4)(ref val3)).rotation, Scale = ((Matrix4x4)(ref val3)).lossyScale }); } } } SkinnedMeshRenderer[] array3 = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[4] { player.thisPlayerModel, player.thisPlayerModelLOD1, player.thisPlayerModelLOD2, player.thisPlayerModelArms }; foreach (SkinnedMeshRenderer val4 in array3) { if (Object.op_Implicit((Object)(object)val4) && Object.op_Implicit((Object)(object)val4.sharedMesh)) { skins.Add(new Skin { Renderer = val4, Original = val4.sharedMesh, Bounds = ((Renderer)val4).localBounds }); } } } private static int Depth(Transform t) { int num = 0; while (Object.op_Implicit((Object)(object)t.parent)) { num++; t = t.parent; } return num; } internal void RestoreFrame() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!frameApplied) { return; } foreach (BoneFrame item in frame) { if (Object.op_Implicit((Object)(object)item.Bone)) { item.Bone.localPosition = item.Position; item.Bone.localRotation = item.Rotation; item.Bone.localScale = item.Scale; } } frame.Clear(); frameApplied = false; } private void Remember(Transform bone) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) if (Object.op_Implicit((Object)(object)bone)) { frame.Add(new BoneFrame { Bone = bone, Position = bone.localPosition, Rotation = bone.localRotation, Scale = bone.localScale }); } } internal void Render(int level, GymSession session, GymWorld world, double now, double flexStarted = -100.0) { //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: 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_0365: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: 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_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: 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_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: 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_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) RestoreFrame(); if (!Object.op_Implicit((Object)(object)Player) || Player.isPlayerDead) { return; } bool flag = false; Vector3 val3; foreach (Skin skin in skins) { if (!Object.op_Implicit((Object)(object)skin.Renderer)) { continue; } if (level > 0 || session != null) { if (!skin.RenderFlagsApplied) { skin.OriginalOffscreen = skin.Renderer.updateWhenOffscreen; skin.OriginalRecalculation = skin.Renderer.forceMatrixRecalculationPerRender; skin.RenderFlagsApplied = true; } skin.Renderer.forceMatrixRecalculationPerRender = true; skin.Renderer.updateWhenOffscreen = session != null || skin.OriginalOffscreen; } else { RestoreRenderFlags(skin); } Mesh sharedMesh = skin.Renderer.sharedMesh; bool flag2 = skin.Muscles != null && Array.IndexOf(skin.Muscles, sharedMesh) >= 0; if ((Object)(object)sharedMesh != (Object)(object)skin.Original && !flag2) { flag = true; continue; } if (level > 0 && skin.Muscles == null) { Mesh val = GymMeshReadback.Read(skin.Original, skin.Renderer, Player.thisPlayerModel, skins[0].Original); try { skin.Muscles = SculptLevels(val, skin.Renderer); } finally { Object.Destroy((Object)(object)val); } } if (skin.Muscles != null) { Mesh val2 = ((level == 0) ? skin.Original : skin.Muscles[level - 1]); if ((Object)(object)sharedMesh != (Object)(object)val2) { skin.Renderer.sharedMesh = val2; } } Bounds bounds = skin.Bounds; if (level > 0) { val3 = ((Bounds)(ref bounds)).size; ((Bounds)(ref bounds)).Expand(((Vector3)(ref val3)).magnitude * 0.15f); } ((Renderer)skin.Renderer).localBounds = bounds; } if (level == 0 && session == null) { return; } Transform[] array = orderedBones; foreach (Transform bone in array) { Remember(bone); } if (Time.unscaledTime >= nextCosmetics) { nextCosmetics = Time.unscaledTime + 1f; cosmetics = (from c in ((Component)Player).GetComponentsInChildren<MonoBehaviour>(true) where Object.op_Implicit((Object)(object)c) && ((object)c).GetType().Name == "CosmeticInstance" select ((Component)c).transform).Distinct().ToArray(); } array = cosmetics; foreach (Transform bone2 in array) { Remember(bone2); } frameApplied = true; if (session != null && world != null) { ExercisePose(session, world, now); } if (level > 0) { Vector3 val4 = ((Component)Player).transform.right; if (bones.TryGetValue("arm.L_upper", out var value) && bones.TryGetValue("arm.R_upper", out var value2)) { val3 = value2.position - value.position; val4 = ((Vector3)(ref val3)).normalized; } string[] sides = Sides; foreach (string text in sides) { if (bones.TryGetValue("shoulder." + text, out var value3)) { Transform obj = value3; obj.position += val4 * (float)((!(text == "L")) ? 1 : (-1)) * (0.012f * (float)level); } string[] array2 = new string[4] { "arm." + text + "_upper", "arm." + text + "_lower", "thigh." + text, "shin." + text }; foreach (string key in array2) { if (bones.TryGetValue(key, out var value4)) { value4.localScale = Vector3.Scale(value4.localScale, new Vector3(1f + (flag ? 0.065f : 0.022f) * (float)level, 1f, 1f + (flag ? 0.065f : 0.022f) * (float)level)); } } } if (flag && bones.TryGetValue("spine.002", out var value5)) { Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(1f + 0.055f * (float)level, 1f, 1f + 0.04f * (float)level); value5.localScale = Vector3.Scale(value5.localScale, val5); if (bones.TryGetValue("spine.004", out var value6)) { value6.localScale = Vector3.Scale(value6.localScale, new Vector3(1f / val5.x, 1f, 1f / val5.z)); } } array = cosmetics; foreach (Transform val6 in array) { if (Object.op_Implicit((Object)(object)val6)) { Transform parent = val6.parent; while (Object.op_Implicit((Object)(object)parent) && !bones.ContainsValue(parent) && (Object)(object)parent != (Object)(object)((Component)Player).transform) { parent = parent.parent; } if (Object.op_Implicit((Object)(object)parent) && ((Object)parent).name.StartsWith("spine", StringComparison.Ordinal) && ((Object)parent).name != "spine.004") { float num2 = 1f + ((((Object)parent).name == "spine" || ((Object)parent).name == "spine.001") ? 0.055f : 0.11f) * (float)level; val6.localScale = Vector3.Scale(val6.localScale, new Vector3(num2, 1f + 0.025f * (float)level, num2)); val6.localPosition = Vector3.Scale(val6.localPosition, new Vector3(num2, 1f, num2)); } else if (Object.op_Implicit((Object)(object)parent) && (((Object)parent).name.Contains("_lower") || ((Object)parent).name.StartsWith("hand", StringComparison.Ordinal) || ((Object)parent).name.StartsWith("shin", StringComparison.Ordinal))) { float num3 = 1f + (((Object)parent).name.StartsWith("shin", StringComparison.Ordinal) ? 0.055f : 0.08f) * (float)level; val6.localScale *= num3; } } } } if (session != null && world != null) { FinishLegs(session, world); FinishHands(session, world, now); } else if (level == 4 && now >= flexStarted && now < flexStarted + 3.5) { FlexPose(Mathf.Clamp01((float)(now - flexStarted) / 0.35f) * Mathf.Clamp01((float)(flexStarted + 3.5 - now) / 0.35f)); } } private void FlexPose(float blend) { //IL_0062: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_020a: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_030d: 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_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) if (!bones.TryGetValue("spine.004", out var value)) { return; } string[] sides = Sides; foreach (string text in sides) { if (!bones.TryGetValue("hand." + text, out var value2)) { continue; } int num = PoseSide(text, ((Component)Player).transform); Vector3 val = ((Component)Player).transform.right * (float)num; Vector3 up = ((Component)Player).transform.up; Vector3 forward = ((Component)Player).transform.forward; List<Transform> list = new List<Transform>(); for (int j = 2; j <= 5; j++) { if (bones.TryGetValue("finger" + j + "." + text, out var value3)) { list.Add(value3); } } if (list.Count > 1) { Vector3 val2 = list.Aggregate(Vector3.zero, (Vector3 sum, Transform b) => sum + b.position) / (float)list.Count - value2.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = Vector3.Cross(normalized, list[list.Count - 1].position - list[0].position); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref normalized2)).sqrMagnitude > 0.5f) { Quaternion val3 = Quaternion.LookRotation(up, -forward) * Quaternion.Inverse(Quaternion.LookRotation(normalized, normalized2)) * value2.rotation; value2.rotation = Quaternion.Slerp(value2.rotation, val3, blend); } } Vector3 val4 = value.position + val * 0.58f + up * 0.16f + forward * 0.02f; SolveLimb(value2, Vector3.Lerp(value2.position, val4, blend), val - up * 0.35f - forward * 0.08f); for (int num2 = 1; num2 <= 5; num2++) { if (bones.TryGetValue("finger" + num2 + "." + text, out var value4)) { Transform obj = value4; obj.localRotation *= Quaternion.AngleAxis((float)((num2 == 1) ? 35 : 65) * blend, value4.InverseTransformDirection(((Component)Player).transform.right * (float)num)); } if (bones.TryGetValue("finger" + num2 + "." + text + ".001", out var value5)) { Transform obj2 = value5; obj2.localRotation *= Quaternion.AngleAxis((float)((num2 == 1) ? 45 : 80) * blend, value5.InverseTransformDirection(((Component)Player).transform.right * (float)num)); } } } } private int Side(string side) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (bones.TryGetValue("hand." + side, out var value) && bindCharacter.TryGetValue(value, out var value2)) { float x = ((Matrix4x4)(ref value2)).GetColumn(3).x; if (Mathf.Abs(x) > 0.01f) { if (!(x < 0f)) { return 1; } return -1; } } if (!(side == "L")) { return 1; } return -1; } private int PoseSide(string side, Transform reference) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (bones.TryGetValue("arm." + side + "_upper", out var value) && bones.TryGetValue("spine", out var value2)) { if (!(Vector3.Dot(value.position - value2.position, reference.right) < 0f)) { return 1; } return -1; } return Side(side); } private static Mesh[] SculptLevels(Mesh source, SkinnedMeshRenderer renderer) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source) || !source.isReadable) { return null; } Vector3[] vertices = source.vertices; Matrix4x4[] bindposes = source.bindposes; BoneWeight[] array = source.boneWeights; if (array.Length != vertices.Length) { NativeArray<byte> bonesPerVertex = source.GetBonesPerVertex(); NativeArray<BoneWeight1> allBoneWeights = source.GetAllBoneWeights(); if (bonesPerVertex.Length != vertices.Length) { return null; } array = (BoneWeight[])(object)new BoneWeight[vertices.Length]; int num = 0; for (int i = 0; i < vertices.Length; i++) { List<BoneWeight1> list = new List<BoneWeight1>(); for (int j = 0; j < bonesPerVertex[i]; j++) { list.Add(allBoneWeights[num++]); } list.Sort((BoneWeight1 a, BoneWeight1 b) => ((BoneWeight1)(ref b)).weight.CompareTo(((BoneWeight1)(ref a)).weight)); float num2 = list.Take(4).Sum((BoneWeight1 w) => ((BoneWeight1)(ref w)).weight); if (num2 < 1E-05f) { continue; } for (int num3 = 0; num3 < Math.Min(4, list.Count); num3++) { BoneWeight1 val = list[num3]; float num4 = ((BoneWeight1)(ref val)).weight / num2; BoneWeight val2 = array[i]; if (num3 == 0) { ((BoneWeight)(ref val2)).boneIndex0 = ((BoneWeight1)(ref val)).boneIndex; ((BoneWeight)(ref val2)).weight0 = num4; } if (num3 == 1) { ((BoneWeight)(ref val2)).boneIndex1 = ((BoneWeight1)(ref val)).boneIndex; ((BoneWeight)(ref val2)).weight1 = num4; } if (num3 == 2) { ((BoneWeight)(ref val2)).boneIndex2 = ((BoneWeight1)(ref val)).boneIndex; ((BoneWeight)(ref val2)).weight2 = num4; } if (num3 == 3) { ((BoneWeight)(ref val2)).boneIndex3 = ((BoneWeight1)(ref val)).boneIndex; ((BoneWeight)(ref val2)).weight3 = num4; } array[i] = val2; } } } Vector3[] array2 = (Vector3[])(object)new Vector3[bindposes.Length]; float[] array3 = new float[bindposes.Length]; Transform[] array4 = renderer.bones; Matrix4x4[] array5 = (Matrix4x4[])(object)new Matrix4x4[bindposes.Length]; for (int num5 = 0; num5 < bindposes.Length; num5++) { array5[num5] = ((Matrix4x4)(ref bindposes[num5])).inverse; } for (int num6 = 0; num6 < bindposes.Length && num6 < array4.Length; num6++) { Transform val3 = array4[num6]; if (!Object.op_Implicit((Object)(object)val3)) { continue; } string name = ((Object)val3).name; array3[num6] = (name.Contains("_upper") ? 0.15f : (name.Contains("_lower") ? 0.09f : (name.StartsWith("thigh", StringComparison.Ordinal) ? 0.12f : (name.StartsWith("shin", StringComparison.Ordinal) ? 0.06f : (name switch { "spine" => 0.055f, "spine.001" => 0.045f, "spine.002" => 0.1f, "spine.003" => 0.115f, _ => name.StartsWith("shoulder", StringComparison.Ordinal) ? 0.055f : 0f, }))))); array2[num6] = Vector3.up; for (int num7 = 0; num7 < array4.Length && num7 < bindposes.Length; num7++) { if (Object.op_Implicit((Object)(object)array4[num7]) && (Object)(object)array4[num7].parent == (Object)(object)val3) { Vector3 val4 = ((Matrix4x4)(ref bindposes[num6])).MultiplyPoint3x4(Vector4.op_Implicit(((Matrix4x4)(ref array5[num7])).GetColumn(3))); if (((Vector3)(ref val4)).sqrMagnitude > 0.001f) { array2[num6] = ((Vector3)(ref val4)).normalized; } break; } } } Mesh[] array6 = (Mesh[])(object)new Mesh[4]; for (int num8 = 1; num8 <= 4; num8++) { Vector3[] array7 = (Vector3[])(object)new Vector3[vertices.Length]; for (int num9 = 0; num9 < vertices.Length; num9++) { BoneWeight val5 = array[num9]; Vector3 delta = Vector3.zero; AddDeformation(ref delta, vertices[num9], ((BoneWeight)(ref val5)).boneIndex0, ((BoneWeight)(ref val5)).weight0, num8, bindposes, array5, array2, array3); AddDeformation(ref delta, vertices[num9], ((BoneWeight)(ref val5)).boneIndex1, ((BoneWeight)(ref val5)).weight1, num8, bindposes, array5, array2, array3); AddDeformation(ref delta, vertices[num9], ((BoneWeight)(ref val5)).boneIndex2, ((BoneWeight)(ref val5)).weight2, num8, bindposes, array5, array2, array3); AddDeformation(ref delta, vertices[num9], ((BoneWeight)(ref val5)).boneIndex3, ((BoneWeight)(ref val5)).weight3, num8, bindposes, array5, array2, array3); array7[num9] = vertices[num9] + delta; } Mesh val6 = Object.Instantiate<Mesh>(source); ((Object)val6).name = "CompanyGym_Level" + num8 + "_" + ((Object)source).name; val6.vertices = array7; val6.RecalculateNormals(); val6.RecalculateBounds(); array6[num8 - 1] = val6; } return array6; } private static void AddDeformation(ref Vector3 delta, Vector3 point, int index, float weight, int level, Matrix4x4[] bind, Matrix4x4[] inverseBind, Vector3[] axes, float[] gains) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (!(weight <= 0f) && index >= 0 && index < bind.Length && gains[index] != 0f) { Vector3 val = ((Matrix4x4)(ref bind[index])).MultiplyPoint3x4(point); Vector3 val2 = val - Vector3.Project(val, axes[index]); Vector3 val3 = ((Matrix4x4)(ref inverseBind[index])).MultiplyPoint3x4(val + val2 * (gains[index] * (float)level)); delta += (val3 - point) * weight; } } private void ExercisePose(GymSession session, GymWorld world, double now) { //IL_0047: 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_006d: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e3: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_020a: 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_0225: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0302: 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_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_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_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: 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_0328: 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_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: 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_0370: 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_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: 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_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: 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_03b6: 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_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: 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_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) int station = session.Station; Transform val = world.Stations[station]; float num = GymWorld.Repetition(session, now); foreach (BoneFrame item in neutral) { if (Object.op_Implicit((Object)(object)item.Bone)) { item.Bone.localPosition = item.Position; item.Bone.localRotation = item.Rotation; item.Bone.localScale = item.Scale; } } Quaternion val2 = Quaternion.identity; Vector3 val3 = world.Point(station, new Vector3(0f, 1.26f, 0f)); if (station == 0) { val3 = world.Point(station, new Vector3(0f, 0.78f, -0.16f)); val2 = Quaternion.AngleAxis(90f, val.right); } if (station == 1) { val3 = world.Point(station, new Vector3(0f, Mathf.Lerp(0.73f, 1.32f, num), Mathf.Lerp(-0.35f, 0f, num))); val2 = Quaternion.AngleAxis(Mathf.Lerp(62f, 0f, num), val.right); } if (station == 2) { val3 = world.Point(station, new Vector3(0f, 0.72f, -0.12f)); } if (station == 4) { val3 = world.Point(station, GymWorld.SquatHip(num)); val2 = Quaternion.AngleAxis(GymWorld.SquatLean(num), val.right); } if (station == 5) { val3 = world.Point(station, new Vector3(0f, Mathf.Lerp(0.96f, 1.62f, num), -0.62f)); val2 = Quaternion.AngleAxis(Mathf.Lerp(0f, -6f, num), val.right); } Transform value; Transform val4 = (Transform)(bones.TryGetValue("spine", out value) ? ((object)value) : ((object)orderedBones.FirstOrDefault())); if (!Object.op_Implicit((Object)(object)val4)) { return; } for (int i = 0; i < orderedBones.Length; i++) { posePositions[i] = orderedBones[i].position; poseRotations[i] = orderedBones[i].rotation; } Vector3 position = val4.position; Vector3 val5 = Vector3.zero; string[] sides = Sides; foreach (string text in sides) { if (bones.TryGetValue("toe." + text, out var value2) && bones.TryGetValue("foot." + text, out var value3)) { val5 += value2.position - value3.position; } } Quaternion val6 = Quaternion.identity; if (bones.TryGetValue("spine.003", out var value4)) { val6 = Quaternion.FromToRotation(value4.position - val4.position, Vector3.up); } Vector3 val7 = Vector3.ProjectOnPlane(val6 * val5, Vector3.up); val5 = ((Vector3)(ref val7)).normalized; Quaternion val8 = ((station == 0) ? (val.rotation * Quaternion.Euler(0f, 180f, 0f)) : val.rotation); Quaternion val9 = ((((Vector3)(ref val5)).sqrMagnitude > 0.5f) ? (val8 * Quaternion.Inverse(Quaternion.LookRotation(val5))) : Quaternion.identity); Quaternion val10 = val2 * val9 * val6; exerciseFeet.Clear(); for (int k = 0; k < orderedBones.Length; k++) { Transform val11 = orderedBones[k]; val11.SetPositionAndRotation(val3 + val10 * (posePositions[k] - position), val10 * poseRotations[k]); if (((Object)val11).name.StartsWith("foot.", StringComparison.Ordinal)) { exerciseFeet[val11] = val9 * val6 * poseRotations[k]; } } } private void FinishLegs(GymSession session, GymWorld world) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) int station = session.Station; Transform val = world.Stations[station]; FootError = 0f; string[] sides = Sides; foreach (string text in sides) { int num = PoseSide(text, val); if (bones.TryGetValue("foot." + text, out var value)) { Vector3 val2 = world.Point(station, new Vector3((float)num * station switch { 5 => 0.14f, 4 => 0.3f, _ => 0.23f, }, (station == 1) ? 0.19f : 0.13f, station switch { 2 => 0.4f, 0 => -0.55f, _ => 0.06f, })); if (station == 5 && bones.TryGetValue("spine", out var value2)) { val2 = value2.position + val.right * ((float)num * 0.14f) - val.forward * 0.32f - Vector3.up * 0.72f; } Vector3 val3 = ((station == 0) ? (-val.forward) : val.forward); if (station == 4) { val3 += val.right * ((float)num * 0.25f); } SolveLimb(value, val2, val3); if (exerciseFeet.TryGetValue(value, out var value3)) { value.rotation = (Quaternion)(station switch { 5 => Quaternion.AngleAxis(25f, val.right), 4 => Quaternion.AngleAxis((float)(num * 10), val.up), _ => Quaternion.identity, }) * value3; } FootError = Mathf.Max(FootError, Vector3.Distance(value.position, val2)); } } } private void FinishHands(GymSession session, GymWorld world, double now) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_028d: 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_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0318: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: 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_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: 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_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: 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_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0365: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: 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_0399: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_0419: 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_0425: Unknown result type (might be due to invalid IL or missing references) int station = session.Station; float num = GymWorld.Repetition(session, now); Transform val = world.Stations[station]; float num2 = 0f; string[] sides = Sides; foreach (string text in sides) { if (!bones.TryGetValue("hand." + text, out var value)) { continue; } int num3 = PoseSide(text, val); List<Transform> list = new List<Transform>(); for (int j = 2; j <= 5; j++) { if (bones.TryGetValue("finger" + j + "." + text, out var value2)) { list.Add(value2); } } Vector3 val2 = Vector3.zero; if (list.Count >= 2) { Vector3 val3 = Vector3.zero; foreach (Transform item in list) { val3 += item.position; } val3 /= (float)list.Count; val2 = value.InverseTransformPoint(val3) * 0.72f; Vector3 val4 = val3 - value.position; Vector3 normalized = ((Vector3)(ref val4)).normalized; val4 = Vector3.Cross(normalized, list[list.Count - 1].position - list[0].position); Vector3 normalized2 = ((Vector3)(ref val4)).normalized; Vector3 val5 = val.forward; Vector3 val6 = val.up; if (station == 1 || station == 4) { val5 = -val.up; val6 = val.forward; } if (station == 2) { val5 = val.right * (float)num3; val6 = val.up; } if (station == 3) { Quaternion val7 = Quaternion.AngleAxis((0f - num) * 90f, val.right); val5 = val7 * -val.up; val6 = val7 * val.forward; } if (station == 5) { val5 = val.up; val6 = val.forward; } if (((Vector3)(ref normalized)).sqrMagnitude > 0.5f && ((Vector3)(ref normalized2)).sqrMagnitude > 0.5f) { value.rotation = Quaternion.LookRotation(val5, val6) * Quaternion.Inverse(Quaternion.LookRotation(normalized, normalized2)) * value.rotation; } } Vector3 val8 = world.Point(station, GymWorld.Grip(station, num3, num)); Vector3 bend = val.TransformDirection(new Vector3((float)num3 * 0.7f, -0.4f, (station == 0) ? (-0.5f) : 0.3f)); if (station == 3) { bend = val.TransformDirection(new Vector3((float)num3 * 0.1f, -1f, 0f)); } if (station == 4) { bend = val.TransformDirection(new Vector3((float)num3 * 0.2f, -1f, -0.2f)); } if (station == 5) { bend = val.TransformDirection(new Vector3((float)num3 * 0.25f, -1f, 0.15f)); } Vector3 val9 = val8 - value.TransformVector(val2); SolveLimb(value, val9, bend); val9 += val8 - value.TransformPoint(val2); SolveLimb(value, val9, bend); num2 = Mathf.Max(num2, Vector3.Distance(value.TransformPoint(val2), val8)); Vector3 val10 = ((station == 2) ? val.forward : val.right); for (int k = 1; k <= 5; k++) { if (bones.TryGetValue("finger" + k + "." + text, out var value3)) { Transform obj = value3; obj.localRotation *= Quaternion.AngleAxis((float)((k == 1) ? 35 : 65), value3.InverseTransformDirection(val10)); } if (bones.TryGetValue("finger" + k + "." + text + ".001", out var value4)) { Transform obj2 = value4; obj2.localRotation *= Quaternion.AngleAxis((float)((k == 1) ? 45 : 80), value4.InverseTransformDirection(val10)); } } } GripError = num2; } private static void SolveLimb(Transform end, Vector3 target, Vector3 bend) { //IL_0023: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Transform parent = end.parent; Transform val = (Object.op_Implicit((Object)(object)parent) ? parent.parent : null); if (!Object.op_Implicit((Object)(object)val)) { return; } Vector3 val2 = parent.position - val.position; Vector3 val3 = end.position - parent.position; float magnitude = ((Vector3)(ref val2)).magnitude; float magnitude2 = ((Vector3)(ref val3)).magnitude; if (!(magnitude < 0.001f) && !(magnitude2 < 0.001f)) { Vector3 val4 = target - val.position; Vector3 normalized = ((Vector3)(ref val4)).normalized; val4 = Vector3.ProjectOnPlane(bend, normalized); Vector3 normalized2 = ((Vector3)(ref val4)).normalized; if (((Vector3)(ref normalized2)).sqrMagnitude < 0.5f) { val4 = Vector3.ProjectOnPlane(Vector3.forward, normalized); normalized2 = ((Vector3)(ref val4)).normalized; } float num = Mathf.Clamp(Vector3.Distance(target, val.position), Mathf.Abs(magnitude - magnitude2) + 0.001f, magnitude + magnitude2 - 0.001f); float num2 = (magnitude * magnitude + num * num - magnitude2 * magnitude2) / (2f * num); Vector3 val5 = val.position + normalized * num2 + normalized2 * Mathf.Sqrt(Mathf.Max(0f, magnitude * magnitude - num2 * num2)); Quaternion rotation = end.rotation; val.rotation = Quaternion.FromToRotation(val2, val5 - val.position) * val.rotation; parent.rotation = Quaternion.FromToRotation(end.position - parent.position, val.position + normalized * num - parent.position) * parent.rotation; end.rotation = rotation; } } public void Dispose() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) RestoreFrame(); foreach (Skin skin in skins) { RestoreRenderFlags(skin); if (Object.op_Implicit((Object)(object)skin.Renderer) && skin.Muscles != null && Array.IndexOf(skin.Muscles, skin.Renderer.sharedMesh) >= 0) { skin.Renderer.sharedMesh = skin.Original; ((Renderer)skin.Renderer).localBounds = skin.Bounds; } if (skin.Muscles == null) { continue; } Mesh[] muscles = skin.Muscles; foreach (Mesh val in muscles) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } } skins.Clear(); } private static void RestoreRenderFlags(Skin skin) { if (skin.RenderFlagsApplied && Object.op_Implicit((Object)(object)skin.Renderer)) { skin.Renderer.updateWhenOffscreen = skin.OriginalOffscreen; skin.Renderer.forceMatrixRecalculationPerRender = skin.OriginalRecalculation; skin.RenderFlagsApplied = false; } } } public static class GymRules { public const int MaxLevel = 4; public const int StationCount = 6; public const int SeriesCount = 3; public const double SeriesSeconds = 10.0; public const double RestSeconds = 1.25; public static readonly string[] NamesPl = new string[6] { "Wyciskanie sztangi", "Martwy ciąg", "Maszyna na barki", "Hantle — oba ramiona", "Przysiady ze sztangą", "Podciąganie" }; public static readonly string[] NamesEn = new string[6] { "Bench press", "Deadlift", "Shoulder press", "Dumbbell curls", "Barbell squats", "Pull-ups" }; private static readonly int[,] Left = new int[6, 3] { { 3, 16, 164 }, { 4, 27, 235 }, { 6, 38, 346 }, { 2, 49, 457 }, { 7, 56, 568 }, { 8, 67, 679 } }; private static readonly int[,] Right = new int[6, 3] { { 5, 26, 245 }, { 7, 35, 148 }, { 8, 24, 267 }, { 9, 32, 186 }, { 6, 28, 254 }, { 5, 46, 138 } }; public static bool ValidStation(int station) { if (station >= 0) { return station < 6; } return false; } public static string Puzzle(int station, int series) { if (!ValidStation(station) || series < 0 || series >= 3) { return ""; } return Left[station, series] + " + " + Right[station, series]; } public static int Answer(int station, int series) { return Left[station, series] + Right[station, series]; } } [Serializable] public sealed class GymRecord { public string Key = ""; public int Level; public int Stations; } [Serializable] public sealed class GymCampaign { public int Schema = 1; public int WorkDays; public List<GymRecord> Players = new List<GymRecord>(); public GymRecord Player(string key) { if (string.IsNullOrEmpty(key)) { throw new ArgumentException("Missing player identity.", "key"); } foreach (GymRecord player in Players) { if (player.Key == key) { return player; } } GymRecord gymRecord = new GymRecord { Key = key }; Players.Add(gymRecord); return gymRecord; } public bool Complete(string key, int station) { if (!GymRules.ValidStation(station)) { return false; } GymRecord gymRecord = Player(key); if (gymRecord.Level >= 4 || (gymRecord.Stations & (1 << station)) != 0) { return false; } gymRecord.Stations |= 1 << station; gymRecord.Level++; return true; } public void EndWorkDay() { WorkDays++; foreach (GymRecord player in Players) { player.Level = Math.Max(0, player.Level - 1); player.Stations = 0; } } public void Death(string key) { GymRecord gymRecord = Player(key); gymRecord.Level = 0; gymRecord.Stations = 0; } public void Validate() { if (Schema != 1 || WorkDays < 0 || Players == null || Players.Count > 1024) { throw new InvalidOperationException("Unsupported or invalid gym save."); } HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); foreach (GymRecord player in Players) { if (player == null || string.IsNullOrEmpty(player.Key) || !hashSet.Add(player.Key) || player.Level < 0 || player.Level > 4 || player.Stations < 0 || player.Stations > 63) { throw new InvalidOperationException("Invalid gym player record."); } } } } [Serializable] public sealed class GymSession { public int Station; public int Series; public int Attempt = 1; public uint Id; public ulong Player; public double Started; public bool Submitted; public bool Correct; public bool Resting; public bool Submit(uint id, int attempt, int answer, double now) { if (Id != id || Attempt != attempt || Resting || Submitted || now < Started || now >= Started + 10.0) { return false; } Submitted = true; Correct = answer == GymRules.Answer(Station, Series); return true; } public bool Tick(double now) { if (Resting) { if (now >= Started) { Resting = false; Submitted = (Correct = false); Attempt++; } return false; } if (now < Started + 10.0) { return false; } if (Submitted && Correct && ++Series == 3) { return true; } Resting = true; Started = now + 1.25; return false; } } internal sealed class GymDisplay : IDisposable { private GameObject root; private GameObject workout; private GameObject idle; private GameObject notification; private GameObject power; private Canvas canvas; private Font font; private Text name; private Text series; private Text puzzle; private Text status; private Text timer; private Text controls; private Text idleTitle; private Text idleDetail; private Text notice; private Image progress; private Image charge; private Text powerText; private float nextCamera; private static readonly Color Ink = new Color(0.025f, 0.045f, 0.055f, 0.96f); private static readonly Color Gold = new Color(0.94f, 0.6f, 0.16f); private static readonly Color Muted = new Color(0.72f, 0.8f, 0.81f); internal bool Ready { get { if (Object.op_Implicit((Object)(object)root) && Object.op_Implicit((Object)(object)canvas)) { return Object.op_Implicit((Object)(object)canvas.worldCamera); } return false; } } private static RectTransform Rect(GameObject go, Vector2 anchor, Vector2 pivot, Vector2 position, Vector2 size) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references) RectTransform component = go.GetComponent<RectTransform>(); Vector2 anchorMin = (component.anchorMax = anchor); component.anchorMin = anchorMin; component.pivot = pivot; component.anchoredPosition = position; component.sizeDelta = size; return component; } private static GameObject Child(Transform parent, string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = 5 }; val.transform.SetParent(parent, false); return val; } private GameObject Panel(string name, Vector2 anchor, Vector2 pivot, Vector2 position, Vector2 size) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Child(root.transform, name); Rect(obj, anchor, pivot, position, size); Image obj2 = obj.AddComponent<Image>(); ((Graphic)obj2).color = Ink; ((Graphic)obj2).raycastTarget = false; return obj; } private Image Block(Transform parent, string name, float x, float top, float w, float h, Color color) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) GameObject obj = Child(parent, name); Rect(obj, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, 0f - top), new Vector2(w, h)); Image obj2 = obj.AddComponent<Image>(); ((Graphic)obj2).color = color; ((Graphic)obj2).raycastTarget = false; return obj2; } private Text Label(Transform parent, string name, float top, float height, int size, Color color, bool bold = false) { //IL_0022: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Child(parent, name + " XUAIGNORE"); RectTransform component = obj.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, 0f - top); component.sizeDelta = new Vector2(-24f, height); Text obj2 = obj.AddComponent<Text>(); obj2.font = font; obj2.fontSize = size; obj2.fontStyle = (FontStyle)(bold ? 1 : 0); ((Graphic)obj2).color = color; obj2.alignment = (TextAnchor)4; obj2.horizontalOverflow = (HorizontalWrapMode)1; obj2.verticalOverflow = (VerticalWrapMode)0; ((Graphic)obj2).raycastTarget = false; return obj2; } private bool Ensure() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0450: 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_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048f: 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_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) if (Ready) { return true; } if (Time.unscaledTime < nextCamera) { return false; } nextCamera = Time.unscaledTime + 1f; Camera val = ((IEnumerable<Camera>)Object.FindObjectsOfType<Camera>()).FirstOrDefault((Func<Camera, bool>)((Camera c) => ((Object)c).name == "UICamera")); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (Object.op_Implicit((Object)(object)root)) { canvas.worldCamera = val; return true; } root = new GameObject("CompanyGym interface", new Type[1] { typeof(RectTransform) }); root.layer = 5; Object.DontDestroyOnLoad((Object)(object)root); canvas = root.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)1; canvas.worldCamera = val; canvas.planeDistance = 1f; canvas.sortingOrder = 30000; CanvasScaler obj = root.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1280f, 720f); obj.matchWidthOrHeight = 0.5f; font = Font.CreateDynamicFontFromOSFont("Arial", 40); workout = Panel("Workout", new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-24f, 45f), new Vector2(360f, 300f)); Block(workout.transform, "Accent", 0f, 0f, 360f, 4f, Gold); name = Label(workout.transform, "Exercise", 10f, 38f, 23, Gold, bold: true); series = Label(workout.transform, "Series", 51f, 25f, 14, Muted); puzzle = Label(workout.transform, "Fixed addition puzzle", 83f, 53f, 34, Color.white, bold: true); status = Label(workout.transform, "Feedback", 140f, 50f, 18, Color.white); status.horizontalOverflow = (HorizontalWrapMode)0; Block(workout.transform, "Progress background", 20f, 205f, 320f, 9f, new Color(0.18f, 0.23f, 0.24f)); progress = Block(workout.transform, "Progress", 20f, 205f, 320f, 9f, Gold); timer = Label(workout.transform, "Time", 220f, 24f, 15, Muted); controls = Label(workout.transform, "Controls", 253f, 38f, 14, Muted); idle = Panel("Gym status", Vector2.zero, Vector2.zero, new Vector2(22f, 52f), new Vector2(290f, 73f)); idleTitle = Label(idle.transform, "Muscle level", 6f, 30f, 20, Color.white); idleDetail = Label(idle.transform, "Hint", 39f, 25f, 15, Muted); notification = Panel("Notice", new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), new Vector2(720f, 54f)); notice = Label(notification.transform, "Message", 4f, 44f, 20, Color.white); power = Panel("Scrap throw", new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 116f), new Vector2(420f, 76f)); powerText = Label(power.transform, "Throw charge", 4f, 44f, 18, Color.white); Block(power.transform, "Charge background", 16f, 56f, 388f, 8f, new Color(0.18f, 0.23f, 0.24f)); charge = Block(power.transform, "Charge", 16f, 56f, 0f, 8f, Gold); return true; } internal void Update(GymPlugin plugin, string input, string message, float until) { //IL_005d: 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_0192: 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_0443: 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_0479: Unknown result type (might be due to invalid IL or missing references) if (Ensure()) { PlayerControllerB localPlayer = GymPlugin.LocalPlayer; GymSession gymSession = ((Object.op_Implicit((Object)(object)localPlayer) && plugin.Ready) ? plugin.SessionFor(localPlayer.actualClientId) : null); workout.SetActive(gymSession != null); idle.SetActive(Object.op_Implicit((Object)(object)localPlayer) && gymSession == null && plugin.Ready && Vector3.Distance(((Component)localPlayer).transform.position, plugin.GymPosition) < 17f); notification.SetActive(Object.op_Implicit((Object)(object)localPlayer) && Time.unscaledTime < until); notice.text = message; power.SetActive(Object.op_Implicit((Object)(object)localPlayer) && plugin.Powers.Charging); if (power.activeSelf) { float chargeAmount = plugin.Powers.ChargeAmount; powerText.text = plugin.T("RZUT ", "THROW ") + Mathf.RoundToInt(chargeAmount * 100f) + "% • " + plugin.T("Puść, aby rzucić", "Release to throw") + "\n" + plugin.T("SYLWETKA ", "MUSCLE ") + plugin.LevelOf(localPlayer.actualClientId) + " / 4"; ((Graphic)charge).rectTransform.sizeDelta = new Vector2(388f * chargeAmount, 8f); } if (idle.activeSelf) { idleTitle.text = "COMPANY GYM " + plugin.LevelOf(localPlayer.actualClientId) + " / 4"; idleDetail.text = "+" + 25 * plugin.LevelOf(localPlayer.actualClientId) + plugin.T("% obrażeń wręcz", "% melee damage") + ((plugin.LevelOf(localPlayer.actualClientId) == 4) ? (" • " + ((object)plugin.FlexKey/*cast due to .constrained prefix*/).ToString() + plugin.T(": poza", ": flex")) : ""); } if (gymSession != null) { name.text = (plugin.Polish ? GymRules.NamesPl[gymSession.Station] : GymRules.NamesEn[gymSession.Station]); series.text = plugin.T("SERIA ", "SET ") + (gymSession.Series + 1) + " / 3 • " + plugin.T("SYLWETKA ", "MUSCLE ") + plugin.LevelOf(localPlayer.actualClientId) + " / 4"; puzzle.text = ((plugin.Now < gymSession.Started && !gymSession.Resting) ? plugin.T("Przygotuj się…", "Get ready…") : (gymSession.Resting ? plugin.T("Krótka przerwa…", "Short rest…") : (GymRules.Puzzle(gymSession.Station, gymSession.Series) + " = " + ((input.Length == 0) ? "?" : input)))); status.text = (gymSession.Resting ? plugin.T("Następna próba za chwilę", "Next attempt starts shortly") : ((!gymSession.Submitted) ? plugin.T("Wpisz wynik i naciśnij ENTER", "Type the answer and press ENTER") : (gymSession.Correct ? plugin.T("DOBRZE! Dokończ serię.", "CORRECT! Finish the set.") : plugin.T("BŁĄD — powtórzysz tę serię.", "INCORRECT — repeat this set.")))); double num = Math.Max(0.0, gymSession.Started + 10.0 - plugin.Now); ((Graphic)progress).rectTransform.sizeDelta = new Vector2(320f * (gymSession.Resting ? 0f : Mathf.Clamp01((float)(num / 10.0))), 9f); ((Graphic)progress).color = (Color)((gymSession.Submitted && !gymSession.Correct) ? new Color(0.8f, 0.25f, 0.19f) : Gold); timer.text = (gymSession.Resting ? "" : (Math.Ceiling(num) + " s")); controls.text = plugin.T("ENTER: zatwierdź\nBACKSPACE: popraw • ESC: wyjdź", "ENTER: submit\nBACKSPACE: edit • ESC: leave"); } } } internal void Hide() { if (Object.op_Implicit((Object)(object)root)) { workout.SetActive(false); idle.SetActive(false); notification.SetActive(false); power.SetActive(false); } } public void Dispose() { if (Object.op_Implicit((Object)(object)root)) { Object.Destroy((Object)(object)root); } if (Object.op_Implicit((Object)(object)font)) { Object.Destroy((Object)(object)font); } } } internal sealed class GymHud : IDisposable { private struct RenderState { internal Renderer Renderer; internal bool Enabled; internal ShadowCastingMode Shadow; } private readonly GymPlugin plugin; private readonly GymDisplay display = new GymDisplay(); private readonly int cameraGeometry = LayerMask.GetMask(new string[5] { "Room", "Default", "Colliders", "Terrain", "MiscLevelGeometry" }); private PlayerControllerB locked; private int lockedStation = -1; private uint lockedRun; private bool lockedFlex; private bool move; private bool look; private bool special; private bool menu; private bool visorEnabled; private bool cursorEnabled; private Vector3 cameraPosition; private Quaternion cameraRotation; private int cameraMask; private bool cameraMoved; private readonly List<RenderState> renderStates = new List<RenderState>(); private readonly List<GameObject> localOverlays = new List<GameObject>(); private readonly Dictionary<GameObject, bool> cosmeticActive = new Dictionary<GameObject, bool>(); private readonly Dictionary<TMP_Text, bool> controlTips = new Dictionary<TMP_Text, bool>(); private int cosmeticMask; private uint sessionId; private int attempt; private string input = ""; private string notice = ""; private float noticeUntil; private GUIStyle title; private GUIStyle body; private GUIStyle small; private GUIStyle number; private GameObject autoTranslator; private float nextTranslatorLookup; private static readonly Key[] Digits; private static readonly Key[] Numpad; internal GymHud(GymPlugin owner) { plugin = owner; } internal void Notice(string text) { notice = text; noticeUntil = Time.unscaledTime + 5f; } internal void HandleInput() { RestoreCamera(); PlayerControllerB localPlayer = GymPlugin.LocalPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } GymSession gymSession = plugin.SessionFor(localPlayer.actualClientId); if (gymSession == null || !plugin.Ready) { return; } if (sessionId != gymSession.Id || attempt != gymSession.Attempt) { sessionId = gymSession.Id; attempt = gymSession.Attempt; input = ""; } Keyboard current = Keyboard.current; if (current == null) { return; } if (((ButtonControl)current.escapeKey).wasPressedThisFrame) { plugin.CancelExercise(); } else { if (gymSession.Submitted || gymSession.Resting || plugin.Now < gymSession.Started) { return; } for (int i = 0; i < 10; i++) { if ((((ButtonControl)current[Digits[i]]).wasPressedThisFrame || ((ButtonControl)current[Numpad[i]]).wasPressedThisFrame) && input.Length < 5) { input += i; } } if (((ButtonControl)current.backspaceKey).wasPressedThisFrame && input.Length > 0) { input = input.Substring(0, input.Length - 1); } if ((((ButtonControl)current.enterKey).wasPressedThisFrame || ((ButtonControl)current.numpadEnterKey).wasPressedThisFrame) && int.TryParse(input, out var result)) { plugin.SubmitAnswer(result); } } } internal void UpdateLock() { //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayer = GymPlugin.LocalPlayer; GymSession gymSession = (Object.op_Implicit((Object)(object)localPlayer) ? plugin.SessionFor(localPlayer.actualClientId) : null); bool flag = Object.op_Implicit((Object)(object)localPlayer) && gymSession == null && plugin.Powers.Flexing(localPlayer.actualClientId); if (!Object.op_Implicit((Object)(object)localPlayer) || localPlayer.isPlayerDead || (!flag && (gymSession == null || !plugin.Ready))) { if (locked != null) { Release(); } return; } uint num = (flag ? plugin.Powers.FlexId(localPlayer.actualClientId) : gymSession.Id); if ((Object)(object)locked != (Object)(object)localPlayer |