using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using GojoSatoruMod.Components; using GojoSatoruMod.Content; using GojoSatoruMod.States; using GojoSatoruMod.Visuals; using HG.Reflection; using KinematicCharacterController; using NLayer; using On.RoR2; using On.RoR2.UI; using On.RoR2.UI.MainMenu; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Skills; using RoR2.UI; using RoR2.UI.MainMenu; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("RyomenSukuna")] [assembly: InternalsVisibleTo("YujiItadori")] [assembly: InternalsVisibleTo("AoiTodo")] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SatoruGojo")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.5.0")] [assembly: AssemblyInformationalVersion("1.1.5+979ebb1e7dfa654951bfcb18204e3745b8f33ff9")] [assembly: AssemblyProduct("SatoruGojo")] [assembly: AssemblyTitle("SatoruGojo")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.5.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace GojoSatoruMod { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("dev.marmennz.satorugojo", "Satoru Gojo", "1.1.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "dev.marmennz.satorugojo"; public const string PluginName = "Satoru Gojo"; public const string PluginVersion = "1.1.5"; internal static ManualLogSource Log { get; private set; } internal static string PluginDirectory { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; JujutsuStartup.UseHost((MonoBehaviour)(object)this); PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); JujutsuAssetPaths.AddPlugin(PluginDirectory); try { JujutsuConfig.Initialize(((BaseUnityPlugin)this).Config); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("The config could not be read, so the mod has not loaded. Deleting BepInEx/config/dev.marmennz.satorugojo.cfg gets a fresh one: " + ex)); return; } Step("Mod Options page", ModOptions.Apply); Step("experience", JujutsuExperienceController.Initialize); Step("skill networking", JujutsuSkillNetworkFix.Initialize); Step("orb sync", GojoOrbSync.Initialize); Step("cursed energy sync", CursedEnergySync.Initialize); Step("Gojo's dash networking", GojoDashSync.Initialize); Step("remote hit networking", JujutsuHitSync.Initialize); Step("diagnostics", JujutsuDiagnostics.Initialize); Step("traffic report", delegate { ((MonoBehaviour)this).StartCoroutine(JujutsuDiagnostics.ReportPeriodically()); }); Step("item displays", NoItemDisplaysController.Initialize); Step("cursed energy bar", CursedEnergyBar.Initialize); Step("skill strip", JujutsuSkillStrip.Initialize); Step("skin index guard", SkinIndexGuard.Initialize); Step("rooted armour", RootedArmorController.Initialize); Step("main menu display", JujutsuMainMenuDisplay.Initialize); Step("Gojo's text", GojoLanguage.Register); Step("black flash text", BlackFlashText.Initialize); Step("texture loading", delegate { ((MonoBehaviour)this).StartCoroutine(JujutsuTextures.ProcessPending()); }); Step("Gojo's assets", GojoAssets.Initialize); Step("icon source report", delegate { ((MonoBehaviour)this).StartCoroutine(ReportWhenEveryoneHasLoaded()); }); Step("Gojo's sounds", delegate { ((MonoBehaviour)this).StartCoroutine(GojoAssets.LoadAttackSounds()); }); Step("shared sfx", delegate { ((MonoBehaviour)this).StartCoroutine(JujutsuSfxAssets.Load()); }); Step("texture audit", delegate { ((MonoBehaviour)this).StartCoroutine(TextureAudit.ReportAfterDelay()); }); Step("content self check", delegate { ((MonoBehaviour)this).StartCoroutine(ContentSelfCheck.RunAfterDelay()); }); Survivor("Gojo", GojoSurvivor.Initialize); Step("content pack", delegate { new JujutsuContentPack().Initialize(); }); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Satoru Gojo 1.1.5 initialized" + ((JujutsuStartup.FailedSteps == 0) ? "." : ($" with {JujutsuStartup.FailedSteps} step(s) missing; see the errors " + "above.")))); } private static void Step(string name, Action action) { JujutsuStartup.Step(name, action); } private static void Survivor(string name, Action action) { JujutsuStartup.Survivor(name, action); } private static IEnumerator ReportWhenEveryoneHasLoaded() { yield return null; GojoAssets.ReportIconSources(); GojoAssets.ReportSkillIcons(); } } internal static class GeneratedVersion { internal const string Value = "1.1.5"; } } namespace GojoSatoruMod.Visuals { internal static class BlackFlashText { internal static void Initialize() { NetworkingAPI.RegisterMessageType(); } internal static void Play(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0023: Unknown result type (might be due to invalid IL or missing references) Vector3 val = position + Vector3.up * 1.6f; Spawn(val); if (NetworkServer.active) { NetMessageExtensions.Send((INetMessage)(object)new BlackFlashCaptionMessage(val), (NetworkDestination)1); } } internal static void Spawn(Vector3 at) { //IL_0005: 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) GameObject val = new GameObject("BlackFlashCaption"); val.transform.position = at; val.AddComponent(); } } public sealed class BlackFlashCaptionMessage : INetMessage, ISerializableObject { private Vector3 position; public BlackFlashCaptionMessage() { } public BlackFlashCaptionMessage(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.position = position; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(position); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) position = reader.ReadVector3(); } public void OnReceived() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { BlackFlashText.Spawn(position); } } } internal sealed class RuntimeBlackFlashText : MonoBehaviour { private const float HoldSeconds = 0.4f; private const float FadeSeconds = 0.75f; private const float RiseSpeed = 1.1f; private static TMP_FontAsset cachedFont; private TextMeshPro front; private TextMeshPro edge; private float age; private void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) TMP_FontAsset font = FindFont(); edge = CreateLayer(font, new Color(0.86f, 0.05f, 0.12f, 1f), new Vector3(0.05f, -0.04f, 0.01f), 1.06f); front = CreateLayer(font, new Color(0.03f, 0f, 0.04f, 1f), Vector3.zero, 1f); } private TextMeshPro CreateLayer(TMP_FontAsset font, Color colour, Vector3 offset, float scale) { //IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_00a5: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BlackFlashLayer"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = offset; val.transform.localScale = Vector3.one * scale; TextMeshPro val2 = val.AddComponent(); if (Object.op_Implicit((Object)(object)font)) { ((TMP_Text)val2).font = font; } ((TMP_Text)val2).text = "BLACK FLASH"; ((TMP_Text)val2).fontSize = 9f; ((Graphic)val2).color = colour; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).fontStyle = (FontStyles)3; ((TMP_Text)val2).outlineWidth = 0f; ((TMP_Text)val2).rectTransform.sizeDelta = new Vector2(14f, 3f); return val2; } private static TMP_FontAsset FindFont() { if (Object.op_Implicit((Object)(object)cachedFont)) { return cachedFont; } TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if (Object.op_Implicit((Object)(object)array[i])) { cachedFont = array[i]; break; } } return cachedFont; } private void Update() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float num = 1.15f; if (age >= num) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Transform transform = ((Component)this).transform; transform.position += Vector3.up * (1.1f * Time.deltaTime); Camera main = Camera.main; if (Object.op_Implicit((Object)(object)main)) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Component)this).transform.position - ((Component)main).transform.position, Vector3.up); } float alpha = ((age <= 0.4f) ? 1f : (1f - Mathf.Clamp01((age - 0.4f) / 0.75f))); ((Component)this).transform.localScale = Vector3.one * (1f + 0.22f * Mathf.Exp((0f - age) * 12f)); SetAlpha(front, alpha); SetAlpha(edge, alpha); } private static void SetAlpha(TextMeshPro text, float alpha) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) if (Object.op_Implicit((Object)(object)text)) { Color color = ((Graphic)text).color; color.a = alpha; ((Graphic)text).color = color; } } } internal static class DomainBarrierVisual { internal const int ClosingShells = 7; internal const float ShellInterval = 0.4f; internal static void SpawnClosingShell(Vector3 center, Color color, float radius, int shellIndex, GojoTechniqueStyle style) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((float)shellIndex / 6f); GojoEffects.Shell(center, color, radius * Mathf.Lerp(1.75f, 1.12f, num), radius * Mathf.Lerp(1.45f, 1.02f, num), 0.4f); } internal static void SpawnSeal(Vector3 center, Color color, float radius, GojoTechniqueStyle style) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) GojoEffects.Shell(center, color, radius * 1.06f, radius, 0.75f, seal: true); } } internal sealed class GojoArmClearance : MonoBehaviour { private const float ChestClearance = 0.62f; private const float HeadClearance = 1.35f; internal string Label = "rig"; private Transform hips; private Transform neck; private Transform head; private Transform leftArm; private Transform rightArm; private Transform leftHand; private Transform rightHand; private float chestRadius; private float headRadius; private bool resolved; private bool reported; internal void Resolve(Transform root) { //IL_01f7: 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_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) if (resolved || !Object.op_Implicit((Object)(object)root)) { return; } resolved = true; Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { string name = ((Object)val).name; if (!Object.op_Implicit((Object)(object)hips) && (Mentions(name, "Pelvis") || Mentions(name, "Hips"))) { hips = val; } else if (!Object.op_Implicit((Object)(object)neck) && IsExactly(name, "Neck")) { neck = val; } else if (!Object.op_Implicit((Object)(object)head) && IsExactly(name, "Head")) { head = val; } else if (IsHand(name)) { if (IsSide(name, 'l') && !Object.op_Implicit((Object)(object)leftHand)) { leftHand = val; } else if (IsSide(name, 'r') && !Object.op_Implicit((Object)(object)rightHand)) { rightHand = val; } } } leftArm = UpFromHand(leftHand); rightArm = UpFromHand(rightHand); if (!Object.op_Implicit((Object)(object)head) && Object.op_Implicit((Object)(object)neck)) { for (int j = 0; j < neck.childCount; j++) { Transform child = neck.GetChild(j); if (Mentions(((Object)child).name, "Head") && !Mentions(((Object)child).name, "Buff") && !Mentions(((Object)child).name, "Loc") && !Mentions(((Object)child).name, "Over")) { head = child; break; } } } float num = ((Object.op_Implicit((Object)(object)leftArm) && Object.op_Implicit((Object)(object)rightArm)) ? (Vector3.Distance(leftArm.position, rightArm.position) * 0.5f) : 0f); float num2 = ((Object.op_Implicit((Object)(object)neck) && Object.op_Implicit((Object)(object)head)) ? Vector3.Distance(neck.position, head.position) : 0f); float num3 = ((Object.op_Implicit((Object)(object)hips) && Object.op_Implicit((Object)(object)neck)) ? Vector3.Distance(hips.position, neck.position) : 0f); if (num3 > 0.01f) { chestRadius = Mathf.Clamp(num, num3 * 0.15f, num3 * 0.6f); headRadius = Mathf.Clamp(num2, num3 * 0.1f, num3 * 0.45f); } else { chestRadius = num; headRadius = num2; } if (!reported) { reported = true; Plugin.Log.LogInfo((object)("Gojo arm clearance [" + Label + "]: " + $"spine {num3:0.000} m, chest half-width " + $"{chestRadius:0.000} m (measured {num:0.000}), " + $"head span {headRadius:0.000} m " + $"(measured {num2:0.000}), arms " + (Object.op_Implicit((Object)(object)leftArm) ? ((Object)leftArm).name : "missing") + " / " + (Object.op_Implicit((Object)(object)rightArm) ? ((Object)rightArm).name : "missing") + ", hands " + (Object.op_Implicit((Object)(object)leftHand) ? ((Object)leftHand).name : "missing") + " / " + (Object.op_Implicit((Object)(object)rightHand) ? ((Object)rightHand).name : "missing") + ", spine " + (Object.op_Implicit((Object)(object)hips) ? ((Object)hips).name : "missing") + " to " + (Object.op_Implicit((Object)(object)neck) ? ((Object)neck).name : "missing") + ", head " + (Object.op_Implicit((Object)(object)head) ? ((Object)head).name : "missing") + ".")); } } private static Transform UpFromHand(Transform hand) { Transform val = (Object.op_Implicit((Object)(object)hand) ? hand.parent : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.parent; } private static bool IsHand(string name) { if (Mentions(name, "Hand") && !Mentions(name, "Finger") && !Mentions(name, "Thumb") && !Mentions(name, "Index") && !Mentions(name, "Middle") && !Mentions(name, "Ring") && !Mentions(name, "Pinky") && !Mentions(name, "Buff") && !Mentions(name, "Weapon")) { return !Mentions(name, "Twist"); } return false; } private static bool IsExactly(string name, string word) { int num = name.LastIndexOf(':'); if (num >= 0 && num + 1 < name.Length) { name = name.Substring(num + 1); } int num2 = name.IndexOf(word, StringComparison.OrdinalIgnoreCase); if (num2 < 0) { return false; } bool num3 = num2 == 0 || !char.IsLetter(name[num2 - 1]); int num4 = num2 + word.Length; bool flag = num4 >= name.Length || !char.IsLetter(name[num4]); if (num3 && flag) { return name.Length <= word.Length + 4; } return false; } private static bool Mentions(string name, string part) { return name.IndexOf(part, StringComparison.OrdinalIgnoreCase) >= 0; } private static bool IsSide(string name, char side) { if (Mentions(name, (side == 'l') ? "left" : "right")) { return true; } for (int i = 0; i < name.Length; i++) { if (char.ToLowerInvariant(name[i]) == side) { bool num = i == 0 || !char.IsLetterOrDigit(name[i - 1]); bool flag = i == name.Length - 1 || !char.IsLetterOrDigit(name[i + 1]); if (num && flag) { return true; } } } return false; } internal void Apply() { Clear(leftArm, leftHand); Clear(rightArm, rightHand); } private void Clear(Transform arm, Transform hand) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)arm) || !Object.op_Implicit((Object)(object)hand)) { return; } Vector3 position = hand.position; position = PushOffSpine(position); position = PushOffHead(position); Vector3 val = position - hand.position; if (!(((Vector3)(ref val)).sqrMagnitude < 1E-06f)) { Vector3 val2 = hand.position - arm.position; Vector3 val3 = position - arm.position; if (!(((Vector3)(ref val2)).sqrMagnitude < 1E-06f) && !(((Vector3)(ref val3)).sqrMagnitude < 1E-06f)) { arm.rotation = Quaternion.FromToRotation(val2, val3) * arm.rotation; } } } private Vector3 PushOffSpine(Vector3 point) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: 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_008c: 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_0091: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)hips) || !Object.op_Implicit((Object)(object)neck) || chestRadius < 0.0001f) { return point; } float num = chestRadius * 0.62f; Vector3 val = ClosestOnSegment(hips.position, neck.position, point); Vector3 val2 = point - val; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude >= num) { return point; } Vector3 val3 = ((magnitude > 0.001f) ? (val2 / magnitude) : ((Component)this).transform.forward); Vector3 result = val + val3 * num; result.y = point.y; return result; } private Vector3 PushOffHead(Vector3 point) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)head) || headRadius < 0.0001f) { return point; } float num = headRadius * 1.35f; Vector3 val = point - head.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude >= num) { return point; } Vector3 val2 = ((magnitude > 0.001f) ? (val / magnitude) : ((Component)this).transform.forward); return head.position + val2 * num; } private static Vector3 ClosestOnSegment(Vector3 start, Vector3 end, Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 val = end - start; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < 0.0001f) { return start; } float num = Mathf.Clamp01(Vector3.Dot(point - start, val) / sqrMagnitude); return start + val * num; } } internal enum GojoCpuPose { Idle, Lobby, Walk, Sprint, RunTurn, RunBackward, Jump, Fall, Flight, FlightCast, PunchLeft, PunchRight, SpinKick, Red, Blue, Purple, Heal, Domain, Cast, Stomp } internal sealed class GojoCpuSkinner : MonoBehaviour { [SerializeField] private MeshFilter meshFilter; [SerializeField] private string[] skeletonNames; [SerializeField] private int[] parentIndices; [SerializeField] private Vector3[] bindLocalPositions; [SerializeField] private Quaternion[] bindLocalRotations; [SerializeField] private Vector3[] bindLocalScales; [SerializeField] private int[] meshBoneToSkeleton; [SerializeField] private BoneWeight[] boneWeights; [SerializeField] private Vector3[] sourceVertices; [SerializeField] private Vector3[] sourceNormals; private Mesh runtimeMesh; private Vector3[] deformedVertices; private Vector3[] deformedNormals; private Matrix4x4[] bindLocalMatrices; private Matrix4x4[] bindGlobalMatrices; private Matrix4x4[] inverseBindGlobalMatrices; private Matrix4x4[] animatedGlobalMatrices; private Matrix4x4[] meshSkinMatrices; private Quaternion[] smoothedPoseRotations; private Vector3[] smoothedPoseTranslations; private int leftElbowPivotIndex = -1; private int rightElbowPivotIndex = -1; private Quaternion smoothedLeftElbowRotation = Quaternion.identity; private Quaternion smoothedRightElbowRotation = Quaternion.identity; private Transform[] externalBones; private GojoCpuPose pose; private bool reportedDomainPath; private float posePhase; private float poseStrength = 1f; private int lastUpdatedFrame = -1; private int diagnosticFrame; private bool diagnosticLogged; private bool failed; internal void Configure(MeshFilter filter, string[] names, int[] parents, Vector3[] localPositions, Quaternion[] localRotations, Vector3[] localScales, int[] localMeshBoneToSkeleton, BoneWeight[] weights, Vector3[] vertices, Vector3[] normals) { meshFilter = filter; skeletonNames = names; parentIndices = parents; bindLocalPositions = localPositions; bindLocalRotations = localRotations; bindLocalScales = localScales; meshBoneToSkeleton = localMeshBoneToSkeleton; boneWeights = weights; sourceVertices = vertices; sourceNormals = normals; EnsureRuntimeData(); } internal void SetPose(GojoCpuPose newPose, float phase, float strength) { pose = newPose; posePhase = phase; poseStrength = Mathf.Clamp01(strength); } internal void UseExternalRig(Transform[] bones) { externalBones = bones; } private void Awake() { EnsureRuntimeData(); } private void Start() { EnsureRuntimeData(); failed = false; diagnosticLogged = false; diagnosticFrame = Time.frameCount + 6; } internal void UpdateSkin() { //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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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_0170: 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_0186: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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_0241: Unknown result type (might be due to invalid IL or missing references) if (failed || lastUpdatedFrame == Time.frameCount) { return; } try { EnsureRuntimeData(); if (!IsReady()) { return; } Renderer component = ((Component)meshFilter).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !component.enabled || !((Component)component).gameObject.activeInHierarchy) { return; } lastUpdatedFrame = Time.frameCount; bool flag = HasExternalRig(); if (pose == GojoCpuPose.Domain && !reportedDomainPath) { reportedDomainPath = true; Plugin.Log.LogInfo((object)("Gojo domain pose driven by " + (flag ? "the rig's own clip" : "the CPU skinner's angles") + " on " + ((Object)this).name + ".")); } if (flag) { BuildExternalSkeleton(); } else { BuildAnimatedSkeleton(); } BuildMeshSkinMatrices(); for (int i = 0; i < sourceVertices.Length; i++) { BoneWeight val = boneWeights[i]; Vector3 point = sourceVertices[i]; deformedVertices[i] = TransformPoint(((BoneWeight)(ref val)).boneIndex0, point) * ((BoneWeight)(ref val)).weight0 + TransformPoint(((BoneWeight)(ref val)).boneIndex1, point) * ((BoneWeight)(ref val)).weight1 + TransformPoint(((BoneWeight)(ref val)).boneIndex2, point) * ((BoneWeight)(ref val)).weight2 + TransformPoint(((BoneWeight)(ref val)).boneIndex3, point) * ((BoneWeight)(ref val)).weight3; if (deformedNormals != null) { Vector3 val2 = sourceNormals[i]; Vector3 val3 = TransformVector(((BoneWeight)(ref val)).boneIndex0, val2) * ((BoneWeight)(ref val)).weight0 + TransformVector(((BoneWeight)(ref val)).boneIndex1, val2) * ((BoneWeight)(ref val)).weight1 + TransformVector(((BoneWeight)(ref val)).boneIndex2, val2) * ((BoneWeight)(ref val)).weight2 + TransformVector(((BoneWeight)(ref val)).boneIndex3, val2) * ((BoneWeight)(ref val)).weight3; deformedNormals[i] = ((((Vector3)(ref val3)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val3)).normalized : val2); } } runtimeMesh.vertices = deformedVertices; if (deformedNormals != null) { runtimeMesh.normals = deformedNormals; } LogMotionDiagnostic(); } catch (Exception arg) { failed = true; RestoreBindPose(); Plugin.Log.LogError((object)("Gojo virtual skeleton stopped on " + ((Object)this).name + "; " + $"the visible bind-pose mesh was restored: {arg}")); } } private bool IsReady() { if (Object.op_Implicit((Object)(object)runtimeMesh) && skeletonNames != null && skeletonNames.Length != 0 && bindLocalMatrices != null && animatedGlobalMatrices != null && meshBoneToSkeleton != null && meshSkinMatrices != null && meshBoneToSkeleton.Length == meshSkinMatrices.Length && boneWeights != null && sourceVertices != null && boneWeights.Length == sourceVertices.Length && deformedVertices != null) { return deformedVertices.Length == sourceVertices.Length; } return false; } private void EnsureRuntimeData() { //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) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)meshFilter) || !Object.op_Implicit((Object)(object)meshFilter.sharedMesh)) { return; } if (!Object.op_Implicit((Object)(object)runtimeMesh)) { runtimeMesh = Object.Instantiate(meshFilter.sharedMesh); ((Object)runtimeMesh).name = ((Object)meshFilter.sharedMesh).name + "_virtualRig"; runtimeMesh.MarkDynamic(); Bounds bounds = runtimeMesh.bounds; ((Bounds)(ref bounds)).Expand(5f); runtimeMesh.bounds = bounds; meshFilter.sharedMesh = runtimeMesh; } if (sourceVertices == null) { sourceVertices = runtimeMesh.vertices; } if (sourceNormals == null) { sourceNormals = runtimeMesh.normals; } if (deformedVertices == null || deformedVertices.Length != sourceVertices.Length) { deformedVertices = (Vector3[])(object)new Vector3[sourceVertices.Length]; } if (sourceNormals != null && sourceNormals.Length == sourceVertices.Length) { if (deformedNormals == null || deformedNormals.Length != sourceVertices.Length) { deformedNormals = (Vector3[])(object)new Vector3[sourceVertices.Length]; } } else { deformedNormals = null; } EnsureVirtualSkeleton(); } private void EnsureVirtualSkeleton() { //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_0108: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0176: 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_0168: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) int num = ((skeletonNames != null) ? skeletonNames.Length : 0); if (num == 0 || parentIndices == null || bindLocalPositions == null || bindLocalRotations == null || bindLocalScales == null || parentIndices.Length != num || bindLocalPositions.Length != num || bindLocalRotations.Length != num || bindLocalScales.Length != num || (bindLocalMatrices != null && bindLocalMatrices.Length == num && meshSkinMatrices != null && meshBoneToSkeleton != null && meshSkinMatrices.Length == meshBoneToSkeleton.Length)) { return; } bindLocalMatrices = (Matrix4x4[])(object)new Matrix4x4[num]; bindGlobalMatrices = (Matrix4x4[])(object)new Matrix4x4[num]; inverseBindGlobalMatrices = (Matrix4x4[])(object)new Matrix4x4[num]; animatedGlobalMatrices = (Matrix4x4[])(object)new Matrix4x4[num]; smoothedPoseRotations = (Quaternion[])(object)new Quaternion[num]; smoothedPoseTranslations = (Vector3[])(object)new Vector3[num]; for (int i = 0; i < num; i++) { smoothedPoseRotations[i] = Quaternion.identity; bindLocalMatrices[i] = Matrix4x4.TRS(bindLocalPositions[i], NormalizeSafe(bindLocalRotations[i]), SanitizeScale(bindLocalScales[i])); int num2 = parentIndices[i]; bool flag = num2 >= 0 && num2 < i && num2 != i; bindGlobalMatrices[i] = (flag ? (bindGlobalMatrices[num2] * bindLocalMatrices[i]) : bindLocalMatrices[i]); inverseBindGlobalMatrices[i] = ((Matrix4x4)(ref bindGlobalMatrices[i])).inverse; if (skeletonNames[i] == "Bip001 L ForeTwist") { leftElbowPivotIndex = i; } else if (skeletonNames[i] == "Bip001 R ForeTwist") { rightElbowPivotIndex = i; } } int num3 = ((meshBoneToSkeleton != null) ? meshBoneToSkeleton.Length : 0); meshSkinMatrices = (Matrix4x4[])(object)new Matrix4x4[num3]; Plugin.Log.LogInfo((object)("Gojo virtual rig initialized for " + ((Object)this).name + ": " + $"{num} bones, {num3} weighted mesh bones.")); } private void BuildAnimatedSkeleton() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_00ff: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float num = ((pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight || pose == GojoCpuPose.SpinKick) ? 27f : 17f); float num2 = 1f - Mathf.Exp((0f - num) * Mathf.Max(Time.deltaTime, 0.0001f)); smoothedLeftElbowRotation = Quaternion.Slerp(smoothedLeftElbowRotation, GetElbowRotation(left: true), num2); smoothedRightElbowRotation = Quaternion.Slerp(smoothedRightElbowRotation, GetElbowRotation(left: false), num2); for (int i = 0; i < animatedGlobalMatrices.Length; i++) { int num3 = parentIndices[i]; Matrix4x4 val = ((num3 >= 0 && num3 < i && num3 != i) ? (animatedGlobalMatrices[num3] * bindLocalMatrices[i]) : bindLocalMatrices[i]); Quaternion poseRotation = GetPoseRotation(i, skeletonNames[i], time); smoothedPoseRotations[i] = Quaternion.Slerp(smoothedPoseRotations[i], poseRotation, num2); Quaternion val2 = smoothedPoseRotations[i]; bool flag = skeletonNames[i].Contains(" L "); bool flag2 = skeletonNames[i].Contains(" R "); if (skeletonNames[i].EndsWith("Hand", StringComparison.Ordinal)) { Quaternion rotation = (flag ? smoothedLeftElbowRotation : (flag2 ? smoothedRightElbowRotation : Quaternion.identity)); int num4 = (flag ? leftElbowPivotIndex : rightElbowPivotIndex); if ((uint)num3 < (uint)animatedGlobalMatrices.Length && (uint)num4 < (uint)bindGlobalMatrices.Length) { Matrix4x4 val3 = animatedGlobalMatrices[num3] * inverseBindGlobalMatrices[num3]; Vector3 pivot = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(Vector4.op_Implicit(((Matrix4x4)(ref bindGlobalMatrices[num4])).GetColumn(3))); val = RotateAtPivot(val, rotation, pivot); } } else if (skeletonNames[i].EndsWith("ForeTwist", StringComparison.Ordinal)) { val = RotateAtOwnPivot(val, flag ? smoothedLeftElbowRotation : smoothedRightElbowRotation); } if (Quaternion.Angle(val2, Quaternion.identity) > 0.001f) { val = (UsesLocalRotation(skeletonNames[i]) ? (val * Matrix4x4.Rotate(val2)) : RotateAtOwnPivot(val, val2)); } Vector3 facialTranslation = GetFacialTranslation(i, skeletonNames[i], time); smoothedPoseTranslations[i] = Vector3.Lerp(smoothedPoseTranslations[i], facialTranslation, num2); Vector3 val4 = smoothedPoseTranslations[i]; if (((Vector3)(ref val4)).sqrMagnitude > 1E-08f) { val = Matrix4x4.Translate(val4) * val; } animatedGlobalMatrices[i] = val; } } private bool HasExternalRig() { if (externalBones != null && skeletonNames != null) { return externalBones.Length == skeletonNames.Length; } return false; } private void BuildExternalSkeleton() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 worldToLocalMatrix = ((Component)meshFilter).transform.worldToLocalMatrix; float time = Time.time; for (int i = 0; i < animatedGlobalMatrices.Length; i++) { Transform val = externalBones[i]; if (!Object.op_Implicit((Object)(object)val)) { animatedGlobalMatrices[i] = bindGlobalMatrices[i]; continue; } Matrix4x4 val2 = worldToLocalMatrix * val.localToWorldMatrix; string text = skeletonNames[i]; if ((text.StartsWith("Bone", StringComparison.Ordinal) && i >= 16 && i <= 68) || text.StartsWith("eye_", StringComparison.Ordinal) || text.StartsWith("meimao_", StringComparison.Ordinal)) { Quaternion poseRotation = GetPoseRotation(i, text, time); val2 = RotateAtOwnPivot(val2, poseRotation); } Vector3 facialTranslation = GetFacialTranslation(i, text, time); if (((Vector3)(ref facialTranslation)).sqrMagnitude > 1E-08f) { val2 = Matrix4x4.Translate(facialTranslation) * val2; } animatedGlobalMatrices[i] = val2; } } private void BuildMeshSkinMatrices() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < meshSkinMatrices.Length; i++) { int num = meshBoneToSkeleton[i]; meshSkinMatrices[i] = (((uint)num < (uint)animatedGlobalMatrices.Length) ? (animatedGlobalMatrices[num] * inverseBindGlobalMatrices[num]) : Matrix4x4.identity); } } private Quaternion GetPoseRotation(int boneIndex, string boneName, float clock) { //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Unknown result type (might be due to invalid IL or missing references) //IL_0b41: Unknown result type (might be due to invalid IL or missing references) //IL_0b46: Unknown result type (might be due to invalid IL or missing references) //IL_0b4b: Unknown result type (might be due to invalid IL or missing references) //IL_0b51: Unknown result type (might be due to invalid IL or missing references) //IL_0b56: Unknown result type (might be due to invalid IL or missing references) //IL_0b5b: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = 0f; float num3 = 0f; bool flag = boneName.Contains(" L "); bool flag2 = boneName.Contains(" R "); float num4 = (flag ? 1f : (flag2 ? (-1f) : 0f)); float num5 = Mathf.Sin(posePhase); float num6 = Mathf.Sin(Mathf.Clamp01(posePhase) * MathF.PI); switch (boneName) { case "Bip001 Pelvis": if (pose == GojoCpuPose.Idle || pose == GojoCpuPose.Lobby) { num += Mathf.Sin(clock * 1.1f) * 1.2f; num3 += Mathf.Sin(clock * 0.7f) * ((pose == GojoCpuPose.Lobby) ? 2.2f : 0.9f); } else if (pose == GojoCpuPose.Walk) { num3 += num5 * 2.5f * poseStrength; } else if (pose == GojoCpuPose.Sprint) { num += 7f * poseStrength; num3 += num5 * 4f * poseStrength; } else if (pose == GojoCpuPose.SpinKick) { num3 += num6 * 28f; } break; case "Bip001 Spine": case "Bip001 Spine1": case "Bip001 Spine2": { float num15 = (boneName.EndsWith("2") ? 1f : (boneName.EndsWith("1") ? 0.7f : 0.4f)); if (pose == GojoCpuPose.Idle || pose == GojoCpuPose.Lobby) { num += Mathf.Sin(clock * 1.1f) * 1.35f * num15; num3 += Mathf.Sin(clock * 0.72f) * ((pose == GojoCpuPose.Lobby) ? 2.4f : 0.7f) * num15; } else if (pose == GojoCpuPose.Walk) { num3 += num5 * 4f * poseStrength * num15; } else if (pose == GojoCpuPose.Sprint) { num += 6f * poseStrength * num15; num3 += num5 * 7f * poseStrength * num15; } else if (pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight) { float num16 = ((pose == GojoCpuPose.PunchLeft) ? (-1f) : 1f); num3 += num16 * num6 * 14f * num15; num -= num6 * 6f * num15; } else if (pose == GojoCpuPose.SpinKick) { num3 -= num6 * 20f * num15; num += num6 * 8f * num15; } else if (pose == GojoCpuPose.Domain) { num -= 5f * num15; num3 += Mathf.Sin(clock * 2.2f) * 3f * num15; } break; } case "Bip001 Neck": case "Bip001 Head": { float num14 = ((boneName == "Bip001 Head") ? 1f : 0.45f); if (pose == GojoCpuPose.Lobby) { num += (-2f + Mathf.Sin(clock * 1.1f) * 2f) * num14; num3 += Mathf.Sin(clock * 0.65f) * 5f * num14; } else if (pose == GojoCpuPose.Idle) { num += Mathf.Sin(clock * 0.8f) * 1.15f * num14; num3 += Mathf.Sin(clock * 0.47f) * 1.8f * num14; } else if (pose == GojoCpuPose.Sprint) { num -= 3f * poseStrength * num14; } else if (pose == GojoCpuPose.Domain) { num -= 7f * num14; } break; } default: if (boneName.EndsWith("Clavicle")) { float num7 = num4 * 4f; num3 += num7; if (pose == GojoCpuPose.Idle || pose == GojoCpuPose.Lobby) { num2 += num4 * Mathf.Sin(clock * 1.1f) * 1.1f; } if (pose == GojoCpuPose.Purple || pose == GojoCpuPose.Domain) { num3 -= num4 * 7f; } } else if (boneName.EndsWith("UpperArm")) { num2 += num4 * 17f; if (pose == GojoCpuPose.Walk) { num3 += num5 * 20f * poseStrength; } else if (pose == GojoCpuPose.Sprint) { num3 += num5 * 36f * poseStrength; num -= 4f * poseStrength; } else if (pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight) { if ((pose == GojoCpuPose.PunchLeft && flag) || (pose == GojoCpuPose.PunchRight && flag2)) { num3 -= num4 * num6 * 68f; num2 -= num4 * num6 * 14f; num -= num6 * 8f; } else { num3 -= num4 * num6 * 22f; num2 -= num4 * num6 * 5f; } } else if (pose == GojoCpuPose.Red && flag2) { num3 -= num4 * (55f + Mathf.Sin(clock * 5f) * 3f); num2 -= num4 * 13f; num -= 5f; } else if (pose == GojoCpuPose.Blue && flag) { num3 -= num4 * (55f + Mathf.Sin(clock * 5f) * 3f); num2 -= num4 * 13f; num -= 5f; } else if (pose == GojoCpuPose.Purple) { float num8 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.16f, 0.74f, posePhase)); num3 -= num4 * Mathf.Lerp(31f, 61f, num8); num2 -= num4 * Mathf.Lerp(7f, 14f, num8); num -= Mathf.Lerp(2f, 7f, num8); } else if (pose == GojoCpuPose.Heal) { num3 -= num4 * 28f; num2 -= num4 * 8f; } else if (pose == GojoCpuPose.Domain) { num3 -= num4 * 46f; num2 -= num4 * 22f; num -= 8f; } else if (pose == GojoCpuPose.Flight) { num2 -= num4 * 8f; num3 += num4 * 5f; } else if (pose == GojoCpuPose.Jump) { num3 -= num4 * 18f * poseStrength; num2 -= num4 * 5f * poseStrength; } else if (pose == GojoCpuPose.SpinKick) { num2 -= num4 * num6 * 11f; num3 += num4 * num6 * 18f; } else if (pose == GojoCpuPose.Lobby && flag2) { float num9 = LobbyGesture(clock); num3 -= num4 * num9 * 48f; num2 -= num4 * num9 * 12f; } } else if (boneName.EndsWith("Hand")) { if (pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight) { bool flag3 = (pose == GojoCpuPose.PunchLeft && flag) || (pose == GojoCpuPose.PunchRight && flag2); num -= (flag3 ? (num6 * 8f) : 0f); num3 += num4 * num6 * 4f; } else if (pose == GojoCpuPose.Purple || pose == GojoCpuPose.Domain) { num3 -= num4 * 7f; } else if (pose == GojoCpuPose.Lobby && flag2) { num3 -= LobbyGesture(clock) * 6f; } } else if (boneName.EndsWith("Thigh")) { float num10 = num4 * num5; if (pose == GojoCpuPose.Walk) { num += num10 * 29f * poseStrength; } else if (pose == GojoCpuPose.Sprint) { num += num10 * 45f * poseStrength; } else if (pose == GojoCpuPose.Jump) { num += (flag ? (-20f * poseStrength) : (27f * poseStrength)); } else if (pose == GojoCpuPose.Flight) { num += num4 * 9f; } else if (pose == GojoCpuPose.SpinKick && flag2) { num -= num6 * 82f; num2 += num6 * 17f; } } else if (boneName.EndsWith("Calf")) { float num11 = num4 * num5; if (pose == GojoCpuPose.Walk) { num += Mathf.Max(0f, 0f - num11) * 34f * poseStrength; } else if (pose == GojoCpuPose.Sprint) { num += Mathf.Max(0f, 0f - num11) * 53f * poseStrength; } else if (pose == GojoCpuPose.Jump) { num += (flag ? (26f * poseStrength) : (12f * poseStrength)); } else if (pose == GojoCpuPose.SpinKick && flag2) { num += (1f - num6) * 30f; } } else if (boneName.EndsWith("Foot")) { float num12 = num4 * num5; if (pose == GojoCpuPose.Walk) { num -= num12 * 8f * poseStrength; } else if (pose == GojoCpuPose.Sprint) { num -= num12 * 13f * poseStrength; } else if (pose == GojoCpuPose.SpinKick && flag2) { num -= num6 * 12f; } } else if (boneName.Contains("Finger")) { float fingerCurl = GetFingerCurl(boneName, flag, flag2, num6); if (GetFingerSuffix(boneName).StartsWith("0", StringComparison.Ordinal)) { num3 -= fingerCurl * 0.45f; num2 += num4 * fingerCurl * 0.32f; } else { num3 -= fingerCurl; } } else if (boneName.StartsWith("Bone", StringComparison.Ordinal) && boneIndex >= 16 && boneIndex <= 68) { float num13 = ((pose == GojoCpuPose.Sprint || pose == GojoCpuPose.Flight) ? 2.2f : 1f); num += Mathf.Sin(clock * 1.8f + (float)boneIndex * 0.37f) * 1.2f * num13; num3 += Mathf.Sin(clock * 1.3f + (float)boneIndex * 0.21f) * 0.8f * num13; } else if (boneName.StartsWith("eye_", StringComparison.Ordinal)) { num2 += Mathf.Sin(clock * 0.55f) * 2.2f; num += Mathf.Sin(clock * 0.38f) * 1.2f; } else if (boneName.StartsWith("meimao_", StringComparison.Ordinal)) { num3 += Mathf.Sin(clock * 0.8f + (float)boneIndex) * 1.1f; } break; } return Quaternion.AngleAxis(num3, Vector3.forward) * Quaternion.AngleAxis(num2, Vector3.up) * Quaternion.AngleAxis(num, Vector3.right); } private float GetFingerCurl(string boneName, bool left, bool right, float attack) { bool flag = (pose == GojoCpuPose.PunchLeft && left) || (pose == GojoCpuPose.PunchRight && right); float num = 4f; if (pose == GojoCpuPose.Walk) { num = 8f; } else if (pose == GojoCpuPose.Sprint) { num = 13f; } else if (flag) { num = Mathf.Lerp(12f, 38f, attack); } else if (pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight) { num = 18f; } else if (pose == GojoCpuPose.Heal) { num = 11f; } else if (pose == GojoCpuPose.Domain) { string fingerSuffix = GetFingerSuffix(boneName); num = ((fingerSuffix.StartsWith("1", StringComparison.Ordinal) || fingerSuffix.StartsWith("2", StringComparison.Ordinal)) ? 4f : 20f); } else if (pose == GojoCpuPose.Red || pose == GojoCpuPose.Blue || pose == GojoCpuPose.Purple) { num = 7f; } string fingerSuffix2 = GetFingerSuffix(boneName); bool flag2 = fingerSuffix2.Length > 1 && fingerSuffix2.EndsWith("2", StringComparison.Ordinal); bool flag3 = fingerSuffix2.Length > 1 && fingerSuffix2.EndsWith("1", StringComparison.Ordinal); return num * (flag2 ? 0.9f : (flag3 ? 0.72f : 0.55f)); } private Quaternion GetElbowRotation(bool left) { //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sin(Mathf.Clamp01(posePhase) * MathF.PI); bool flag = (pose == GojoCpuPose.PunchLeft && left) || (pose == GojoCpuPose.PunchRight && !left); float num2 = 7f; if (pose == GojoCpuPose.Walk) { num2 = 10f + Mathf.Abs(Mathf.Sin(posePhase)) * 9f * poseStrength; } else if (pose == GojoCpuPose.Sprint) { num2 = 28f + Mathf.Abs(Mathf.Sin(posePhase)) * 12f * poseStrength; } else if (flag) { num2 = Mathf.Lerp(46f, 5f, num); } else if (pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight) { num2 = 42f; } else if (pose == GojoCpuPose.Red || pose == GojoCpuPose.Blue) { num2 = 19f; } else if (pose == GojoCpuPose.Purple) { float num3 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.16f, 0.74f, posePhase)); num2 = Mathf.Lerp(24f, 55f, num3); } else if (pose == GojoCpuPose.Domain) { num2 = 40f; } else if (pose == GojoCpuPose.Heal) { num2 = 31f; } else if (pose == GojoCpuPose.Jump) { num2 = 24f; } else if (pose == GojoCpuPose.Flight) { num2 = 13f; } else if (pose == GojoCpuPose.SpinKick) { num2 = 30f; } else if (pose == GojoCpuPose.Lobby && !left) { num2 += LobbyGesture(Time.time) * 30f; } return Quaternion.AngleAxis((0f - (left ? 1f : (-1f))) * num2, Vector3.forward); } private static string GetFingerSuffix(string boneName) { int num = boneName.IndexOf("Finger", StringComparison.Ordinal); if (num < 0) { return string.Empty; } return boneName.Substring(num + "Finger".Length); } private static bool UsesLocalRotation(string boneName) { if (!boneName.Contains("Finger") && !boneName.EndsWith("Hand", StringComparison.Ordinal)) { return boneName.EndsWith("ForeTwist1", StringComparison.Ordinal); } return true; } private Vector3 GetFacialTranslation(int boneIndex, string boneName, float clock) { //IL_004e: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Pow(Mathf.Clamp01(Mathf.Sin(clock * 1.45f - 0.6f)), 22f); float num2 = Mathf.Sin(clock * 1.1f); if (boneName.StartsWith("jiemao_", StringComparison.Ordinal)) { return new Vector3(0f, 0f, -0.006f * num); } if (boneName == "zui") { float num3 = ((pose == GojoCpuPose.Purple || pose == GojoCpuPose.Domain) ? 1f : 0f); return new Vector3(0f, -0.002f * num3, -0.0025f * (0.5f + num2 * 0.5f)); } if (boneName.StartsWith("zui_", StringComparison.Ordinal)) { float num4 = ((bindGlobalMatrices != null && (uint)boneIndex < (uint)bindGlobalMatrices.Length) ? bindGlobalMatrices[boneIndex].m03 : 0f); float num5 = ((pose == GojoCpuPose.Lobby) ? (0.0015f * (0.5f + Mathf.Sin(clock * 0.7f) * 0.5f)) : 0f); return new Vector3(Mathf.Sign(num4) * num5, 0f, num5 * 0.7f); } if (boneName.StartsWith("meimao_", StringComparison.Ordinal)) { return new Vector3(0f, 0f, Mathf.Sin(clock * 0.8f + (float)boneIndex) * 0.001f); } return Vector3.zero; } private void LogMotionDiagnostic() { //IL_002f: 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) if (!diagnosticLogged && Time.frameCount >= diagnosticFrame) { diagnosticLogged = true; float num = 0f; for (int i = 0; i < deformedVertices.Length; i++) { float num2 = num; Vector3 val = deformedVertices[i] - sourceVertices[i]; num = Mathf.Max(num2, ((Vector3)(ref val)).magnitude); } Plugin.Log.LogInfo((object)("Gojo virtual joints active on " + ((Object)this).name + ": " + $"maximum vertex motion {num:F4}m.")); } } private Vector3 TransformPoint(int localBoneIndex, Vector3 point) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((uint)localBoneIndex >= (uint)meshSkinMatrices.Length) { return point; } return ((Matrix4x4)(ref meshSkinMatrices[localBoneIndex])).MultiplyPoint3x4(point); } private Vector3 TransformVector(int localBoneIndex, Vector3 vector) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((uint)localBoneIndex >= (uint)meshSkinMatrices.Length) { return vector; } return ((Matrix4x4)(ref meshSkinMatrices[localBoneIndex])).MultiplyVector(vector); } private static Matrix4x4 RotateAtOwnPivot(Matrix4x4 matrix, Quaternion rotation) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Vector3 pivot = Vector4.op_Implicit(((Matrix4x4)(ref matrix)).GetColumn(3)); return RotateAtPivot(matrix, rotation, pivot); } private static Matrix4x4 RotateAtPivot(Matrix4x4 matrix, Quaternion rotation, Vector3 pivot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) return Matrix4x4.Translate(pivot) * Matrix4x4.Rotate(rotation) * Matrix4x4.Translate(-pivot) * matrix; } private static Quaternion NormalizeSafe(Quaternion rotation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Sqrt(rotation.x * rotation.x + rotation.y * rotation.y + rotation.z * rotation.z + rotation.w * rotation.w); if (num < 0.0001f || float.IsNaN(num) || float.IsInfinity(num)) { return Quaternion.identity; } float num2 = 1f / num; return new Quaternion(rotation.x * num2, rotation.y * num2, rotation.z * num2, rotation.w * num2); } private static Vector3 SanitizeScale(Vector3 scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) return new Vector3(SanitizeScaleAxis(scale.x), SanitizeScaleAxis(scale.y), SanitizeScaleAxis(scale.z)); } private static float SanitizeScaleAxis(float value) { if (float.IsNaN(value) || float.IsInfinity(value) || Mathf.Abs(value) < 0.0001f) { return 1f; } return value; } private static float LobbyGesture(float clock) { float num = Mathf.Repeat(clock, 9f); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(2.2f, 3.2f, num)); float num3 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(5.2f, 6.2f, num)); return num2 * (1f - num3); } private void RestoreBindPose() { if (Object.op_Implicit((Object)(object)runtimeMesh) && sourceVertices != null) { runtimeMesh.vertices = sourceVertices; if (sourceNormals != null && sourceNormals.Length == sourceVertices.Length) { runtimeMesh.normals = sourceNormals; } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)runtimeMesh)) { Object.Destroy((Object)(object)runtimeMesh); } } } internal sealed class GojoDefaultOutfitToggle : MonoBehaviour { private Renderer defaultRenderer; private GameObject[] groups; private CharacterModel characterModel; private GojoModelVisibilityController visibility; private Renderer[] applied; private Renderer[][] groupRenderers; internal void Configure(Renderer renderer, GameObject[] outfitGroups, CharacterModel model) { defaultRenderer = renderer; groups = outfitGroups; characterModel = model; groupRenderers = new Renderer[outfitGroups.Length][]; for (int i = 0; i < outfitGroups.Length; i++) { groupRenderers[i] = (Object.op_Implicit((Object)(object)outfitGroups[i]) ? outfitGroups[i].GetComponentsInChildren(true) : Array.Empty()); } visibility = (Object.op_Implicit((Object)(object)model) ? ((Component)model).GetComponentInChildren(true) : null); applied = null; } internal string DescribeState() { StringBuilder stringBuilder = new StringBuilder(); if (groups != null) { for (int i = 0; i < groups.Length; i++) { if (stringBuilder.Length > 0) { stringBuilder.Append(", "); } stringBuilder.Append(Object.op_Implicit((Object)(object)groups[i]) ? $"{((Object)groups[i]).name} active={groups[i].activeSelf}" : ""); } } return "default=" + (Object.op_Implicit((Object)(object)defaultRenderer) ? ("'" + ((Object)defaultRenderer).name + "'") : "") + $", showing {((applied != null) ? applied.Length : 0)} renderer(s)" + $", registered {RegisteredCount()}" + ", groups: " + ((stringBuilder.Length > 0) ? stringBuilder.ToString() : "none"); } private void LateUpdate() { if (!Object.op_Implicit((Object)(object)defaultRenderer) || groups == null) { return; } Renderer[] array = DesiredRenderers(); if (!SameSet(array, applied) || RegisteredCount() != array.Length) { applied = array; if (Object.op_Implicit((Object)(object)visibility)) { visibility.ReplaceVisibleRenderers(array); } else { ShowOnly(array); } Register(array); } } private Renderer[] DesiredRenderers() { for (int i = 0; i < groups.Length; i++) { if (Object.op_Implicit((Object)(object)groups[i]) && groups[i].activeSelf && groupRenderers[i].Length != 0) { return groupRenderers[i]; } } return (Renderer[])(object)new Renderer[1] { defaultRenderer }; } private static bool SameSet(Renderer[] left, Renderer[] right) { if (left == null || right == null) { return false; } if (left.Length != right.Length) { return false; } for (int i = 0; i < left.Length; i++) { if ((Object)(object)left[i] != (Object)(object)right[i]) { return false; } } return true; } private int RegisteredCount() { if (!Object.op_Implicit((Object)(object)characterModel) || characterModel.baseRendererInfos == null) { if (applied != null) { return applied.Length; } return 0; } return characterModel.baseRendererInfos.Length; } private void Register(Renderer[] visible) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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 (Object.op_Implicit((Object)(object)characterModel)) { RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[visible.Length]; for (int i = 0; i < visible.Length; i++) { array[i] = new RendererInfo { renderer = visible[i], defaultMaterial = (Object.op_Implicit((Object)(object)visible[i]) ? visible[i].sharedMaterial : null), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } characterModel.baseRendererInfos = array; characterModel.materialsDirty = true; } } private void ShowOnly(Renderer[] visible) { if (Object.op_Implicit((Object)(object)defaultRenderer)) { defaultRenderer.enabled = false; } for (int i = 0; i < groupRenderers.Length; i++) { Renderer[] array = groupRenderers[i]; for (int j = 0; j < array.Length; j++) { if (Object.op_Implicit((Object)(object)array[j])) { array[j].enabled = false; } } } for (int k = 0; k < visible.Length; k++) { if (Object.op_Implicit((Object)(object)visible[k])) { visible[k].enabled = true; } } } } internal static class GojoEffects { internal static GojoCollapseVisual Collapse(Vector3 at, Color colour, float radius, float life) { //IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GojoBlueCollapse"); val.transform.position = at; GojoCollapseVisual gojoCollapseVisual = val.AddComponent(); gojoCollapseVisual.Initialize(colour, radius, life); return gojoCollapseVisual; } internal static GojoRepulseVisual Repulse(Vector3 at, Color colour, float radius, float life, Vector3 facing = default(Vector3)) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GojoRedRepulse"); val.transform.position = at; if (((Vector3)(ref facing)).sqrMagnitude > 0.0001f) { val.transform.rotation = Quaternion.LookRotation(((Vector3)(ref facing)).normalized, Vector3.up); } GojoRepulseVisual gojoRepulseVisual = val.AddComponent(); gojoRepulseVisual.Initialize(colour, radius, life); return gojoRepulseVisual; } internal static GojoHollowVisual Hollow(Vector3 at, Color colour, float radius, float life) { //IL_0005: 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_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GojoHollowPurple"); val.transform.position = at; GojoHollowVisual gojoHollowVisual = val.AddComponent(); gojoHollowVisual.Initialize(colour, radius, life); return gojoHollowVisual; } internal static GojoDomeVisual Shell(Vector3 at, Color colour, float fromRadius, float toRadius, float life, bool seal = false) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(seal ? "GojoDomainSeal" : "GojoDomainShell"); val.transform.position = at; GojoDomeVisual gojoDomeVisual = val.AddComponent(); gojoDomeVisual.Initialize(colour, fromRadius, toRadius, life, seal); return gojoDomeVisual; } internal static GojoStrikeVisual Strike(Vector3 at, Vector3 facing, float size = 1f) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GojoStrike"); val.transform.position = at; if (((Vector3)(ref facing)).sqrMagnitude > 0.0001f) { val.transform.rotation = Quaternion.LookRotation(((Vector3)(ref facing)).normalized, Vector3.up); } GojoStrikeVisual gojoStrikeVisual = val.AddComponent(); gojoStrikeVisual.Initialize(size); return gojoStrikeVisual; } } internal abstract class GojoEffectVisual : MonoBehaviour { protected readonly List materials = new List(); protected float duration; protected float age; protected float Phase => Mathf.Clamp01(age / duration); protected LineRenderer MakeLine(string lineName, Material material, int points, float width) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(lineName); val.transform.SetParent(((Component)this).transform, false); LineRenderer obj = val.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)obj); obj.useWorldSpace = false; obj.positionCount = points; obj.numCornerVertices = 2; obj.numCapVertices = 2; obj.widthMultiplier = width; ((Renderer)obj).material = material; return obj; } protected Material Claim(Material material) { if (Object.op_Implicit((Object)(object)material)) { materials.Add(material); } return material; } protected void Finish() { Object.Destroy((Object)(object)((Component)this).gameObject); } protected virtual void OnDestroy() { for (int i = 0; i < materials.Count; i++) { if (Object.op_Implicit((Object)(object)materials[i])) { Object.Destroy((Object)(object)materials[i]); } } materials.Clear(); } } internal sealed class GojoCollapseVisual : GojoEffectVisual { private const int Streaks = 16; private const int SkirtSegments = 48; private LineRenderer[] streaks; private Vector3[] streakDirections; private float[] streakOffsets; private LineRenderer skirt; private Transform core; private Material coreMaterial; private Light light; private Color colour; private float radius; private float lightPeak; internal void Initialize(Color tint, float effectRadius, float life) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) colour = tint; radius = Mathf.Max(1f, effectRadius); duration = Mathf.Max(0.2f, life); Color val = Color.Lerp(colour, Color.white, 0.25f); val.a = 0.85f; Material material = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoCollapseStreaks", val)); streaks = (LineRenderer[])(object)new LineRenderer[16]; streakDirections = (Vector3[])(object)new Vector3[16]; streakOffsets = new float[16]; for (int i = 0; i < 16; i++) { streakDirections[i] = Random.onUnitSphere; streakOffsets[i] = Random.value * 0.35f; streaks[i] = MakeLine("CollapseStreak_" + i, material, 2, radius * 0.05f); } skirt = MakeLine("CollapseSkirt", Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoCollapseSkirt", new Color(colour.r, colour.g, colour.b, 0.5f))), 49, radius * 0.04f); GameObject val2 = JujutsuPrimitives.Sphere("CollapseCore", Vector3.zero, ownMaterial: false); val2.transform.SetParent(((Component)this).transform, false); core = val2.transform; Renderer component = val2.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); coreMaterial = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoCollapseCore", new Color(colour.r, colour.g, colour.b, 0.6f))); component.material = coreMaterial; } lightPeak = 4.5f; light = JujutsuFxLights.TryAdd(((Component)this).gameObject, colour, 0.2f, radius * 2.2f, major: true); } private void Update() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float phase = base.Phase; for (int i = 0; i < streaks.Length; i++) { LineRenderer val = streaks[i]; if (Object.op_Implicit((Object)(object)val)) { float num = Mathf.Clamp01((phase - streakOffsets[i]) / (1f - streakOffsets[i])); float num2 = Mathf.Lerp(radius, 0f, num * num); float num3 = Mathf.Min(radius * 1.15f, num2 + radius * 0.45f); val.SetPosition(0, streakDirections[i] * num3); val.SetPosition(1, streakDirections[i] * num2); val.widthMultiplier = radius * 0.05f * (1f - num * 0.7f); ((Renderer)val).enabled = num > 0f && num < 1f; } } if (Object.op_Implicit((Object)(object)skirt)) { float num4 = Mathf.Lerp(radius * 1.1f, radius * 0.1f, phase); for (int j = 0; j <= 48; j++) { float num5 = (float)j / 48f * MathF.PI * 2f; skirt.SetPosition(j, new Vector3(Mathf.Cos(num5) * num4, 0f, Mathf.Sin(num5) * num4)); } } if (Object.op_Implicit((Object)(object)core)) { float num6 = Mathf.Lerp(radius * 0.85f, radius * 0.12f, phase * phase); core.localScale = Vector3.one * num6; Color val2 = colour; val2.a = Mathf.Lerp(0.35f, 0.95f, phase); JujutsuFxMaterials.SetTint(coreMaterial, val2); } if (Object.op_Implicit((Object)(object)light)) { light.intensity = Mathf.Lerp(0.2f, lightPeak, phase * phase); } if (age >= duration) { Finish(); } } } internal sealed class GojoRepulseVisual : GojoEffectVisual { private const int Spokes = 18; private const int SkirtSegments = 48; private LineRenderer[] spokes; private Vector3[] spokeDirections; private LineRenderer skirt; private Transform flash; private Material flashMaterial; private Light light; private Color colour; private float radius; internal void Initialize(Color tint, float effectRadius, float life) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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) colour = tint; radius = Mathf.Max(1f, effectRadius); duration = Mathf.Max(0.2f, life); Color val = Color.Lerp(colour, Color.white, 0.35f); val.a = 0.9f; Material material = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoRepulseSpokes", val)); spokes = (LineRenderer[])(object)new LineRenderer[18]; spokeDirections = (Vector3[])(object)new Vector3[18]; for (int i = 0; i < 18; i++) { spokeDirections[i] = Random.onUnitSphere; spokes[i] = MakeLine("RepulseSpoke_" + i, material, 2, radius * 0.07f); } skirt = MakeLine("RepulseSkirt", Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoRepulseSkirt", new Color(colour.r, colour.g, colour.b, 0.65f))), 49, radius * 0.06f); GameObject val2 = JujutsuPrimitives.Sphere("RepulseFlash", Vector3.zero, ownMaterial: false); val2.transform.SetParent(((Component)this).transform, false); flash = val2.transform; Renderer component = val2.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); flashMaterial = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoRepulseFlash", Color.Lerp(colour, Color.white, 0.5f))); component.material = flashMaterial; } light = JujutsuFxLights.TryAdd(((Component)this).gameObject, colour, 6f, radius * 2.6f, major: true); } private void Update() { //IL_008e: 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_00a8: 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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_0205: 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) age += Time.deltaTime; float phase = base.Phase; float num = 1f - (1f - phase) * (1f - phase); for (int i = 0; i < spokes.Length; i++) { LineRenderer val = spokes[i]; if (Object.op_Implicit((Object)(object)val)) { float num2 = Mathf.Lerp(radius * 0.2f, radius * 1.45f, num); float num3 = Mathf.Max(0f, num2 - radius * 0.5f); val.SetPosition(0, spokeDirections[i] * num3); val.SetPosition(1, spokeDirections[i] * num2); val.widthMultiplier = radius * 0.07f * (1f - phase); } } if (Object.op_Implicit((Object)(object)skirt)) { float num4 = Mathf.Lerp(radius * 0.15f, radius * 1.6f, num); for (int j = 0; j <= 48; j++) { float num5 = (float)j / 48f * MathF.PI * 2f; skirt.SetPosition(j, new Vector3(Mathf.Cos(num5) * num4, 0f, Mathf.Sin(num5) * num4)); } skirt.widthMultiplier = radius * 0.06f * (1f - phase); } if (Object.op_Implicit((Object)(object)flash)) { float num6 = Mathf.Lerp(radius * 0.3f, radius * 1.2f, num); flash.localScale = Vector3.one * num6; Color val2 = Color.Lerp(colour, Color.white, 0.5f); val2.a = Mathf.Lerp(0.8f, 0f, phase * 1.6f); JujutsuFxMaterials.SetTint(flashMaterial, val2); } if (Object.op_Implicit((Object)(object)light)) { light.intensity = Mathf.Lerp(6f, 0f, phase); } if (age >= duration) { Finish(); } } } internal sealed class GojoHollowVisual : GojoEffectVisual { private const int Arcs = 6; private const int ArcPoints = 7; private const float ArcInterval = 0.055f; private Transform core; private Transform rim; private Material coreMaterial; private Material rimMaterial; private LineRenderer[] arcs; private Light light; private Color colour; private float radius; private float nextArcAt; internal void Initialize(Color tint, float effectRadius, float life) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) colour = tint; radius = Mathf.Max(1f, effectRadius); duration = Mathf.Max(0.2f, life); GameObject val = JujutsuPrimitives.Sphere("HollowCore", Vector3.zero, ownMaterial: false); val.transform.SetParent(((Component)this).transform, false); core = val.transform; Renderer component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); coreMaterial = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoHollowCore", new Color(0.03f, 0.01f, 0.06f, 0.95f), 1f)); component.material = coreMaterial; } GameObject val2 = JujutsuPrimitives.Sphere("HollowRim", Vector3.zero, ownMaterial: false); val2.transform.SetParent(((Component)this).transform, false); rim = val2.transform; Renderer component2 = val2.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { JujutsuFxMaterials.PrepareRenderer(component2); rimMaterial = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoHollowRim", new Color(colour.r, colour.g, colour.b, 0.3f))); component2.material = rimMaterial; } Color val3 = Color.Lerp(colour, Color.white, 0.55f); val3.a = 0.95f; Material material = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoHollowArcs", val3)); arcs = (LineRenderer[])(object)new LineRenderer[6]; for (int i = 0; i < 6; i++) { arcs[i] = MakeLine("HollowArc_" + i, material, 7, radius * 0.045f); } LayArcs(); light = JujutsuFxLights.TryAdd(((Component)this).gameObject, colour, 3.4f, radius * 2.4f, major: true); } private void LayArcs() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < arcs.Length; i++) { LineRenderer val = arcs[i]; if (Object.op_Implicit((Object)(object)val)) { Vector3 onUnitSphere = Random.onUnitSphere; Vector3 onUnitSphere2 = Random.onUnitSphere; for (int j = 0; j < 7; j++) { float num = (float)j / 6f; Vector3 val2 = Vector3.Slerp(onUnitSphere, onUnitSphere2, num); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num2 = ((j == 0 || j == 6) ? 0f : Random.Range(-0.14f, 0.2f)); val.SetPosition(j, normalized * (radius * (0.62f + num2))); } } } } private void Update() { //IL_0070: 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_00a0: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float phase = base.Phase; if (age >= nextArcAt) { nextArcAt = age + 0.055f; LayArcs(); } float num = 1f + Mathf.Sin(age * 7f) * 0.05f; if (Object.op_Implicit((Object)(object)core)) { core.localScale = Vector3.one * (radius * 0.6f * num); } if (Object.op_Implicit((Object)(object)rim)) { rim.localScale = Vector3.one * (radius * 0.78f * num); Color val = colour; val.a = 0.22f + Mathf.Sin(age * 9f) * 0.06f; JujutsuFxMaterials.SetTint(rimMaterial, val); } if (Object.op_Implicit((Object)(object)light)) { light.intensity = 3.4f * (1f - phase * 0.35f); } if (age >= duration) { Finish(); } } } internal sealed class GojoStrikeVisual : GojoEffectVisual { private const int Lines = 3; private LineRenderer[] lines; private Vector3[] directions; private float size; internal void Initialize(float scale) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ad: Unknown result type (might be due to invalid IL or missing references) size = Mathf.Max(0.4f, scale); duration = 0.14f; Material material = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoStrike", new Color(0.95f, 0.96f, 1f, 0.9f))); lines = (LineRenderer[])(object)new LineRenderer[3]; directions = (Vector3[])(object)new Vector3[3]; for (int i = 0; i < 3; i++) { float num = (float)i / 3f * MathF.PI + Random.value * 0.4f; Vector3[] array = directions; int num2 = i; Vector3 val = new Vector3(Mathf.Cos(num), Mathf.Sin(num) * 0.35f, 0f); array[num2] = ((Vector3)(ref val)).normalized; lines[i] = MakeLine("StrikeLine_" + i, material, 2, size * 0.12f); } } private void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_007d: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float phase = base.Phase; for (int i = 0; i < lines.Length; i++) { LineRenderer val = lines[i]; if (Object.op_Implicit((Object)(object)val)) { float num = Mathf.Lerp(size * 0.3f, size * 1.5f, phase); val.SetPosition(0, -directions[i] * num); val.SetPosition(1, directions[i] * num); val.widthMultiplier = size * 0.12f * (1f - phase); } } if (age >= duration) { Finish(); } } } internal sealed class GojoOrbShell : GojoEffectVisual { private const int Streaks = 9; private const float FlickerInterval = 0.05f; private Transform[] shells; private Material[] shellMaterials; private LineRenderer[] streaks; private Color colour; private GojoTechniqueStyle style; private float nextFlickerAt; internal static GojoOrbShell Attach(GameObject orb, Color tint, GojoTechniqueStyle technique) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)orb)) { return null; } GojoOrbShell gojoOrbShell = orb.AddComponent(); gojoOrbShell.Initialize(tint, technique); return gojoOrbShell; } private void Initialize(Color tint, GojoTechniqueStyle technique) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) colour = tint; style = technique; duration = float.MaxValue; bool flag = style == GojoTechniqueStyle.Purple; shells = (Transform[])(object)new Transform[2]; shellMaterials = (Material[])(object)new Material[2]; for (int i = 0; i < shells.Length; i++) { GameObject val = JujutsuPrimitives.Sphere("OrbShell_" + i, Vector3.zero, ownMaterial: false); val.transform.SetParent(((Component)this).transform, false); val.transform.localScale = Vector3.one * (1.25f + (float)i * 0.45f); shells[i] = val.transform; Renderer component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); Color val2 = ((flag && i == 0) ? new Color(0.04f, 0.01f, 0.07f, 0.85f) : new Color(colour.r, colour.g, colour.b, 0.3f - (float)i * 0.14f)); shellMaterials[i] = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoOrbShell" + i, val2)); component.material = shellMaterials[i]; } } Color val3 = Color.Lerp(colour, Color.white, 0.45f); val3.a = 0.9f; Material material = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoOrbStreaks", val3)); streaks = (LineRenderer[])(object)new LineRenderer[9]; for (int j = 0; j < 9; j++) { streaks[j] = MakeLine("OrbStreak_" + j, material, 2, 0.08f); } Flicker(); } private void Flicker() { //IL_001b: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0077: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < streaks.Length; i++) { LineRenderer val = streaks[i]; if (Object.op_Implicit((Object)(object)val)) { Vector3 onUnitSphere = Random.onUnitSphere; float num = Random.Range(1.1f, 1.5f); float num2 = num + Random.Range(0.5f, 1.4f); switch (style) { case GojoTechniqueStyle.Blue: val.SetPosition(0, onUnitSphere * num2); val.SetPosition(1, onUnitSphere * num); break; case GojoTechniqueStyle.Purple: { Vector3 onUnitSphere2 = Random.onUnitSphere; val.SetPosition(0, onUnitSphere * 1.3f); val.SetPosition(1, Vector3.Slerp(onUnitSphere, onUnitSphere2, 0.35f) * 1.3f); break; } default: val.SetPosition(0, onUnitSphere * num); val.SetPosition(1, onUnitSphere * num2); break; } val.widthMultiplier = Random.Range(0.05f, 0.12f); } } } private void Update() { //IL_008a: 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) age += Time.deltaTime; if (age >= nextFlickerAt) { nextFlickerAt = age + 0.05f; Flicker(); } for (int i = 0; i < shells.Length; i++) { if (Object.op_Implicit((Object)(object)shells[i])) { float num = Random.Range(-0.03f, 0.03f); float num2 = Mathf.Sin(age * (7f + (float)i * 3f)) * 0.05f; shells[i].localScale = Vector3.one * (1.25f + (float)i * 0.45f + num2 + num); shells[i].Rotate((12f + (float)i * 9f) * Time.deltaTime, (18f - (float)i * 7f) * Time.deltaTime, 0f, (Space)1); } } } } internal sealed class GojoDomeVisual : GojoEffectVisual { private const int GroundSegments = 64; private Transform shell; private Material shellMaterial; private LineRenderer ground; private Light light; private Color colour; private float fromRadius; private float toRadius; private bool seal; internal void Initialize(Color tint, float from, float to, float life, bool isSeal) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) colour = tint; fromRadius = Mathf.Max(1f, from); toRadius = Mathf.Max(1f, to); duration = Mathf.Max(0.15f, life); seal = isSeal; GameObject val = JujutsuPrimitives.Sphere("DomainWall", Vector3.zero, ownMaterial: false); val.transform.SetParent(((Component)this).transform, false); shell = val.transform; Renderer component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); Color val2 = colour; val2.a = (seal ? 0.28f : 0.12f); shellMaterial = Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoDomainWall", val2)); component.material = shellMaterial; } Color val3 = Color.Lerp(colour, Color.white, 0.4f); val3.a = (seal ? 0.9f : 0.45f); ground = MakeLine("DomainGroundRing", Claim(JujutsuFxMaterials.CreateLineMaterial("matGojoDomainGround", val3)), 65, toRadius * 0.02f); if (seal) { light = JujutsuFxLights.TryAdd(((Component)this).gameObject, colour, 5f, toRadius * 1.2f, major: true); } } private void Update() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float phase = base.Phase; float num = 1f - (1f - phase) * (1f - phase); float num2 = Mathf.Lerp(fromRadius, toRadius, num); if (Object.op_Implicit((Object)(object)shell)) { shell.localScale = Vector3.one * (num2 * 2f); Color val = colour; val.a = (seal ? 0.28f : 0.12f) * (1f - phase); JujutsuFxMaterials.SetTint(shellMaterial, val); } if (Object.op_Implicit((Object)(object)ground)) { for (int i = 0; i <= 64; i++) { float num3 = (float)i / 64f * MathF.PI * 2f; ground.SetPosition(i, new Vector3(Mathf.Cos(num3) * num2, 0f, Mathf.Sin(num3) * num2)); } ground.widthMultiplier = toRadius * 0.02f * (seal ? (1f - phase * 0.5f) : (1f - phase)); } if (Object.op_Implicit((Object)(object)light)) { light.intensity = 5f * (1f - phase); } if (age >= duration) { Finish(); } } } internal static class GojoExtraSkins { private sealed class Wardrobe { internal string Model; internal string TextureDirectory; internal string[] Skins; } private sealed class Source { internal Wardrobe Wardrobe; internal string[] BoneNames; internal int[] Parents; internal Vector3[] LocalPositions; internal Quaternion[] LocalRotations; internal Vector3[] LocalScales; internal Matrix4x4[] Rest; internal Matrix4x4[] BindPoses; internal int SkinOffset; } private sealed class Part { internal string Name; internal int Outfit; internal Source From; internal string Texture; internal bool IsCutout; internal Vector3[] Vertices; internal Vector3[] Normals; internal Vector2[] Uvs; internal BoneWeight[] Weights; internal int[] Triangles; } private static readonly Wardrobe[] Wardrobes = new Wardrobe[2] { new Wardrobe { Model = "satoru.model", TextureDirectory = "satoru", Skins = new string[2] { "SUMMER", "SUIT" } }, new Wardrobe { Model = "shinjuku.model", TextureDirectory = "shinjuku", Skins = new string[2] { "SHINJUKU", "SHINJUKUBARE" } } }; private static readonly string[] SkinNames = Wardrobes.SelectMany((Wardrobe wardrobe) => wardrobe.Skins).ToArray(); private static readonly (Color Primary, Color Secondary)[] SkinIconColors = new(Color, Color)[5] { (new Color(0.05f, 0.06f, 0.1f), new Color(0.45f, 0.78f, 1f)), (new Color(0.09f, 0.13f, 0.16f), new Color(1f, 0.84f, 0.45f)), (new Color(0.03f, 0.03f, 0.04f), new Color(0.92f, 0.92f, 0.96f)), (new Color(0.1f, 0.09f, 0.09f), new Color(0.94f, 0.91f, 0.86f)), (new Color(0.14f, 0.11f, 0.1f), new Color(0.86f, 0.72f, 0.6f)) }; private static readonly Dictionary textureCache = new Dictionary(StringComparer.Ordinal); private static List sources; private static List parts; private static readonly HumanBodyBones[] HeightChain; internal static string WardrobeModelForSkin(int skinIndex) { int num = 0; Wardrobe[] wardrobes = Wardrobes; foreach (Wardrobe wardrobe in wardrobes) { if (skinIndex >= num && skinIndex < num + wardrobe.Skins.Length) { return wardrobe.Model; } num += wardrobe.Skins.Length; } return null; } internal static void RegisterOnPrefab(GameObject bodyPrefab) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) try { ModelSkinController val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponentInChildren(true) : null); if (!Object.op_Implicit((Object)(object)val)) { return; } if (!Wardrobes.Any((Wardrobe wardrobe) => File.Exists(JujutsuAssetPaths.Find("assets", wardrobe.Model)))) { Plugin.Log.LogInfo((object)"Gojo extra skins: no outfit model shipped, so only the default outfit is offered."); return; } Transform val2 = (Object.op_Implicit((Object)(object)val.characterModel) ? ((Component)val.characterModel).transform : ((Component)val).transform); GameObject[] array = (GameObject[])(object)new GameObject[SkinNames.Length]; for (int num = 0; num < array.Length; num++) { string text = "GojoOutfit" + SkinNames[num]; Transform val3 = val2.Find(text); array[num] = (GameObject)(Object.op_Implicit((Object)(object)val3) ? ((object)((Component)val3).gameObject) : ((object)new GameObject(text))); array[num].layer = ((Component)val2).gameObject.layer; array[num].transform.SetParent(val2, false); array[num].SetActive(false); } List list = new List(); for (int num2 = 0; num2 < array.Length; num2++) { list.Add(BuildSkin(SkinNames[num2], num2, num2, ((Component)val2).gameObject, array)); } val.skins = list.ToArray(); Plugin.Log.LogInfo((object)($"Gojo extra skins: registered {list.Count} skins on " + $"{((Object)bodyPrefab).name} ({array.Length} outfit groups).")); } catch (Exception arg) { Plugin.Log.LogError((object)$"Gojo extra skins could not be registered: {arg}"); } } private static SkinDef BuildSkin(string skinName, int shown, int colorIndex, GameObject root, GameObject[] groups) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) SkinDef val = ScriptableObject.CreateInstance(); ((Object)val).name = "skinGojo" + skinName; val.nameToken = "CODEX_GOJO_SKIN_" + skinName + "_NAME"; if (colorIndex >= 0 && colorIndex < SkinIconColors.Length) { int index = colorIndex; string fileName = "gojo-skin-" + skinName.ToLowerInvariant(); val.icon = GojoAssets.LoadIcon(fileName, () => GojoAssets.CreateSkinIcon("texGojoSkin" + skinName, SkinIconColors[index].Primary, SkinIconColors[index].Secondary)); } val.rootObject = root; val.baseSkins = Array.Empty(); val.unlockableDef = null; SkinDefParams val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "skinParamsGojo" + skinName; val2.rendererInfos = Array.Empty(); val2.meshReplacements = Array.Empty(); val2.projectileGhostReplacements = Array.Empty(); val2.minionSkinReplacements = Array.Empty(); val2.lightReplacements = Array.Empty(); GameObjectActivation[] array = (GameObjectActivation[])(object)new GameObjectActivation[groups.Length]; for (int num = 0; num < groups.Length; num++) { array[num] = new GameObjectActivation { gameObject = groups[num], shouldActivate = (num == shown) }; } val2.gameObjectActivations = array; val.skinDefParams = val2; val.Bake(); return val; } internal static void Apply(CharacterModel characterModel, SkinnedMeshRenderer template) { //IL_01d6: 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_0203: Unknown result type (might be due to invalid IL or missing references) try { if (!Object.op_Implicit((Object)(object)characterModel) || !Object.op_Implicit((Object)(object)template) || !Object.op_Implicit((Object)(object)template.sharedMesh) || !Load()) { return; } Animator val = FindHumanoidAnimator(characterModel); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)"Gojo extra skins: no humanoid Avatar on the rig, so Mixamo bone names cannot be resolved. Skipped."); return; } GameObject[] array = FindGroups(characterModel); if (array == null) { Plugin.Log.LogWarning((object)"Gojo extra skins: the outfit groups the prefab was given are missing from this instance. Skipped."); return; } AlignToRenderer(array, ((Component)template).transform); Dictionary dictionary = new Dictionary(); foreach (Source source in sources) { int resolved; GojoOutfitRig gojoOutfitRig = BuildRig(source, characterModel, val, template, out resolved); Plugin.Log.LogInfo((object)("Gojo extra skins: " + source.Wardrobe.Model + " has " + $"{resolved} of {source.BoneNames.Length} outfit " + "bones following the live rig.")); if (resolved < source.BoneNames.Length / 2) { Plugin.Log.LogWarning((object)("Gojo extra skins: " + source.Wardrobe.Model + " resolved too few bones to follow the rig and is skipped.")); Object.Destroy((Object)(object)((Component)gojoOutfitRig).gameObject); } else { dictionary[source] = gojoOutfitRig; } } if (dictionary.Count == 0) { return; } List list = new List(characterModel.baseRendererInfos); foreach (Part part in parts) { if (dictionary.TryGetValue(part.From, out var value)) { Renderer val2 = BuildRenderer(part, value, template, array[part.Outfit].transform); if (Object.op_Implicit((Object)(object)val2)) { list.Add(new RendererInfo { renderer = val2, defaultMaterial = val2.sharedMaterial, ignoreOverlays = false, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } } characterModel.baseRendererInfos = list.ToArray(); characterModel.materialsDirty = true; (((Component)characterModel).gameObject.GetComponent() ?? ((Component)characterModel).gameObject.AddComponent()).Configure((Renderer)(object)template, array, characterModel); Plugin.Log.LogInfo((object)($"Gojo extra skins: filled {parts.Count} mesh part(s) " + $"into {array.Length} outfit group(s).")); GameObject[] array2 = array; foreach (GameObject val3 in array2) { Plugin.Log.LogInfo((object)($" '{((Object)val3).name}': {val3.transform.childCount} " + $"renderer(s), active={val3.activeSelf}")); } } catch (Exception arg) { Plugin.Log.LogError((object)$"Gojo extra skins could not be built: {arg}"); } } private static Animator FindHumanoidAnimator(CharacterModel characterModel) { Animator[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren(true); foreach (Animator val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val.avatar) && val.avatar.isValid && val.avatar.isHuman) { return val; } } return null; } private static GojoOutfitRig BuildRig(Source source, CharacterModel characterModel, Animator humanoid, SkinnedMeshRenderer template, out int resolved) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0278: 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_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_0201: Unknown result type (might be due to invalid IL or missing references) Transform[] bones = template.bones; Matrix4x4[] bindposes = template.sharedMesh.bindposes; Dictionary dictionary = new Dictionary(); for (int i = 0; i < bones.Length && i < bindposes.Length; i++) { if (Object.op_Implicit((Object)(object)bones[i])) { dictionary[bones[i]] = ((Matrix4x4)(ref bindposes[i])).inverse; } } GameObject val = new GameObject("GojoOutfitRig_" + source.Wardrobe.Model); val.transform.SetParent(((Component)characterModel).transform, false); val.layer = ((Component)characterModel).gameObject.layer; AlignToRenderer((GameObject[])(object)new GameObject[1] { val }, ((Component)template).transform); Transform[] array = (Transform[])(object)new Transform[source.BoneNames.Length]; Transform[] array2 = (Transform[])(object)new Transform[source.BoneNames.Length]; Quaternion[] array3 = (Quaternion[])(object)new Quaternion[source.BoneNames.Length]; int rootBone = 0; resolved = 0; for (int j = 0; j < source.BoneNames.Length; j++) { GameObject val2 = new GameObject(source.BoneNames[j]); val2.layer = val.layer; val2.transform.SetParent((source.Parents[j] < 0) ? val.transform : array[source.Parents[j]], false); val2.transform.localPosition = source.LocalPositions[j]; val2.transform.localRotation = source.LocalRotations[j]; val2.transform.localScale = source.LocalScales[j]; array[j] = val2.transform; array3[j] = Quaternion.identity; if (source.Parents[j] < 0) { rootBone = j; } if (GojoMixamoBinding.TryGetHumanBone(source.BoneNames[j], out var role)) { Transform boneTransform = humanoid.GetBoneTransform(role); if (Object.op_Implicit((Object)(object)boneTransform) && dictionary.TryGetValue(boneTransform, out var value)) { array2[j] = boneTransform; array3[j] = Quaternion.Inverse(((Matrix4x4)(ref value)).rotation) * ((Matrix4x4)(ref source.Rest[j])).rotation; resolved++; } } } MeasureHeights(source, humanoid, array, out var rigHeight, out var outfitHeight); float num = ((JujutsuConfig.GojoOutfitScale != null) ? JujutsuConfig.GojoOutfitScale.Value : 1f); float num2 = ((rigHeight > 0.0001f && outfitHeight > 0.0001f) ? (rigHeight / outfitHeight * num) : num); Transform transform = val.transform; transform.localScale *= num2; Plugin.Log.LogInfo((object)("Gojo extra skins: " + source.Wardrobe.Model + " skeleton scaled " + $"by {num2:0.000} (rig {rigHeight:0.000}, outfit " + $"{outfitHeight:0.000} foot to head in world units, tuning " + $"{num:0.00}).")); GojoOutfitRig gojoOutfitRig = val.AddComponent(); gojoOutfitRig.SetLabel(source.Wardrobe.Model); gojoOutfitRig.Configure(array, array2, array3, rootBone, humanoid.GetBoneTransform((HumanBodyBones)5), humanoid.GetBoneTransform((HumanBodyBones)6), FindProxy(source, array, (HumanBodyBones)5), FindProxy(source, array, (HumanBodyBones)6)); return gojoOutfitRig; } private static void MeasureHeights(Source source, Animator humanoid, Transform[] proxies, out float rigHeight, out float outfitHeight) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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) rigHeight = 0f; outfitHeight = 0f; Transform val = null; Transform val2 = null; for (int i = 0; i < HeightChain.Length; i++) { Transform boneTransform = humanoid.GetBoneTransform(HeightChain[i]); Transform val3 = FindProxy(source, proxies, HeightChain[i]); if (Object.op_Implicit((Object)(object)boneTransform) && Object.op_Implicit((Object)(object)val3)) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2)) { rigHeight += Vector3.Distance(val.position, boneTransform.position); outfitHeight += Vector3.Distance(val2.position, val3.position); } val = boneTransform; val2 = val3; } } } private static Transform FindProxy(Source source, Transform[] proxies, HumanBodyBones role) { //IL_0015: 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) for (int i = 0; i < source.BoneNames.Length; i++) { if (GojoMixamoBinding.TryGetHumanBone(source.BoneNames[i], out var role2) && role2 == role) { return proxies[i]; } } return null; } private static Matrix4x4[] BindPoses(Source source) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (source.BindPoses != null) { return source.BindPoses; } source.BindPoses = (Matrix4x4[])(object)new Matrix4x4[source.Rest.Length]; for (int i = 0; i < source.Rest.Length; i++) { source.BindPoses[i] = ((Matrix4x4)(ref source.Rest[i])).inverse; } return source.BindPoses; } private static Renderer BuildRenderer(Part part, GojoOutfitRig rig, SkinnedMeshRenderer template, Transform parent) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //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_00a6: Unknown result type (might be due to invalid IL or missing references) int num = part.Vertices.Length; Mesh val = new Mesh { name = "meshGojo_" + part.Name, indexFormat = (IndexFormat)(num > 65000) }; val.vertices = part.Vertices; val.normals = part.Normals; val.uv = part.Uvs; val.boneWeights = part.Weights; val.bindposes = BindPoses(part.From); val.triangles = part.Triangles; val.RecalculateBounds(); GameObject val2 = new GameObject(part.Name) { layer = ((Component)parent).gameObject.layer }; val2.transform.SetParent(parent, false); SkinnedMeshRenderer obj = val2.AddComponent(); obj.sharedMesh = val; obj.bones = rig.Bones; obj.rootBone = rig.Root; ((Renderer)obj).sharedMaterial = BuildMaterial(template, part); obj.quality = (SkinQuality)4; obj.updateWhenOffscreen = true; return (Renderer)(object)obj; } private static Material BuildMaterial(SkinnedMeshRenderer template, Part part) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) Material val = Object.Instantiate(((Renderer)template).sharedMaterial); ((Object)val).name = "matGojoSkin_" + part.Name; Texture2D val2 = LoadTexture(part.From.Wardrobe.TextureDirectory, part.Texture); if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)val2); } if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } if (part.IsCutout && val.HasProperty("_EnableCutout")) { val.SetFloat("_EnableCutout", 1f); } return val; } private static Texture2D LoadTexture(string directory, string textureName) { if (string.IsNullOrEmpty(textureName)) { return Texture2D.whiteTexture; } string key = directory + "/" + textureName; if (textureCache.TryGetValue(key, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } string text = JujutsuAssetPaths.Find("assets", directory, textureName); bool flag = File.Exists(text); TextureAudit.Record(directory, textureName, flag); if (!flag) { Plugin.Log.LogWarning((object)("Gojo skin texture was not found: " + text)); return Texture2D.whiteTexture; } Texture2D val = JujutsuTextures.Load(text, "texGojoSkin_" + Path.GetFileNameWithoutExtension(textureName), (TextureWrapMode)1); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)("Gojo skin texture failed to decode: " + text)); return Texture2D.whiteTexture; } textureCache[key] = val; return val; } private static void AlignToRenderer(GameObject[] groups, Transform reference) { //IL_0028: 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_002d: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject obj in groups) { Transform parent = obj.transform.parent; Vector3 val = (Object.op_Implicit((Object)(object)parent) ? parent.lossyScale : Vector3.one); obj.transform.SetPositionAndRotation(reference.position, reference.rotation); Vector3 lossyScale = reference.lossyScale; obj.transform.localScale = new Vector3(Mathf.Approximately(val.x, 0f) ? 1f : (lossyScale.x / val.x), Mathf.Approximately(val.y, 0f) ? 1f : (lossyScale.y / val.y), Mathf.Approximately(val.z, 0f) ? 1f : (lossyScale.z / val.z)); } } private static GameObject[] FindGroups(CharacterModel characterModel) { GameObject[] array = (GameObject[])(object)new GameObject[SkinNames.Length]; for (int i = 0; i < array.Length; i++) { Transform val = ((Component)characterModel).transform.Find("GojoOutfit" + SkinNames[i]); if (!Object.op_Implicit((Object)(object)val)) { return null; } array[i] = ((Component)val).gameObject; } return array; } private static bool Load() { if (sources != null) { return parts.Count > 0; } sources = new List(); parts = new List(); int num = 0; Wardrobe[] wardrobes = Wardrobes; foreach (Wardrobe wardrobe in wardrobes) { string path = JujutsuAssetPaths.Find("assets", wardrobe.Model); if (File.Exists(path)) { ReadSource(path, wardrobe, num); } else { Plugin.Log.LogInfo((object)("Gojo extra skins: " + wardrobe.Model + " is absent, so " + string.Join(", ", wardrobe.Skins) + " will not be offered.")); } num += wardrobe.Skins.Length; } return parts.Count > 0; } private static void ReadSource(string path, Wardrobe wardrobe, int offset) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_013c: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0295: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) Source source = new Source { Wardrobe = wardrobe, SkinOffset = offset }; sources.Add(source); int count = parts.Count; using FileStream input = File.OpenRead(path); using BinaryReader binaryReader = new BinaryReader(input); if (new string(binaryReader.ReadChars(8)) != "SUKNMDL1") { throw new InvalidDataException("Gojo skin model header is invalid."); } int num = binaryReader.ReadInt32(); if (num != 2) { throw new InvalidDataException($"Unsupported Gojo skin model version {num}."); } int num2 = binaryReader.ReadInt32(); source.BoneNames = new string[num2]; source.Parents = new int[num2]; source.LocalPositions = (Vector3[])(object)new Vector3[num2]; source.LocalRotations = (Quaternion[])(object)new Quaternion[num2]; source.LocalScales = (Vector3[])(object)new Vector3[num2]; Matrix4x4[] array = (Matrix4x4[])(object)new Matrix4x4[num2]; for (int i = 0; i < num2; i++) { source.BoneNames[i] = binaryReader.ReadString(); source.Parents[i] = binaryReader.ReadInt32(); source.LocalPositions[i] = ReadVector3(binaryReader); source.LocalRotations[i] = ReadQuaternion(binaryReader); source.LocalScales[i] = ReadVector3(binaryReader); array[i] = Matrix4x4.TRS(source.LocalPositions[i], source.LocalRotations[i], source.LocalScales[i]); } source.Rest = (Matrix4x4[])(object)new Matrix4x4[num2]; for (int j = 0; j < num2; j++) { source.Rest[j] = ((source.Parents[j] < 0) ? array[j] : (source.Rest[source.Parents[j]] * array[j])); } int num3 = binaryReader.ReadInt32(); for (int k = 0; k < num3; k++) { Part part = new Part { Name = binaryReader.ReadString(), Outfit = binaryReader.ReadInt32(), From = source }; binaryReader.ReadString(); part.Texture = binaryReader.ReadString(); part.IsCutout = binaryReader.ReadBoolean(); int num4 = binaryReader.ReadInt32(); part.Vertices = (Vector3[])(object)new Vector3[num4]; part.Normals = (Vector3[])(object)new Vector3[num4]; part.Uvs = (Vector2[])(object)new Vector2[num4]; part.Weights = (BoneWeight[])(object)new BoneWeight[num4]; for (int l = 0; l < num4; l++) { part.Vertices[l] = ReadVector3(binaryReader); part.Normals[l] = ReadVector3(binaryReader); part.Uvs[l] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); BoneWeight[] weights = part.Weights; int num5 = l; BoneWeight val = default(BoneWeight); ((BoneWeight)(ref val)).boneIndex0 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex1 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex2 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex3 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).weight0 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight1 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight2 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight3 = binaryReader.ReadSingle(); weights[num5] = val; } int num6 = binaryReader.ReadInt32(); part.Triangles = new int[num6]; for (int m = 0; m < num6; m++) { part.Triangles[m] = binaryReader.ReadInt32(); } if ((uint)part.Outfit < (uint)wardrobe.Skins.Length) { part.Outfit += source.SkinOffset; parts.Add(part); } } Plugin.Log.LogInfo((object)("Gojo extra skins: " + wardrobe.Model + " gave " + $"{parts.Count - count} mesh " + $"part(s) over {num2} Mixamo bones for " + string.Join(", ", wardrobe.Skins) + ".")); } private static Vector3 ReadVector3(BinaryReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } private static Quaternion ReadQuaternion(BinaryReader reader) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } static GojoExtraSkins() { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_018e: 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) HumanBodyBones[] array = new HumanBodyBones[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); HeightChain = (HumanBodyBones[])(object)array; } } internal sealed class GojoHumanoidAnimationDriver : MonoBehaviour { internal const string AnimationBundleFileName = "sett_animations.bundle"; internal const string SkinBundleFileName = "gojo_sett_skin.bundle"; private GameObject animatedModel; private Animator animator; private GojoArmClearance clearance; private SkinnedMeshRenderer skinRenderer; private Transform characterModelTransform; private Transform animationRootTransform; private Vector3 animationRootLocalPosition; private Quaternion animationRootLocalRotation; private Vector3 animationRootLocalScale; private Vector3 avatarRootPositionOffset; private Quaternion avatarRootRotationOffset; private Transform rootBone; private bool initializationAttempted; private bool ready; private bool failureLogged; private GojoCpuPose loggedPose = (GojoCpuPose)(-1); private readonly HashSet reportedMissingClips = new HashSet(); internal bool IsReady => ready; internal Animator RigAnimator => animator; private void Start() { EnsureInitialized(); } internal bool ApplyPose(GojoCpuPose pose, float phase, float strength) { EnsureInitialized(); if (!ready) { return false; } try { string clipName = GetClipName(pose); AnimationClip clip = GojoHumanoidAnimationLibrary.GetClip(clipName); if (!Object.op_Implicit((Object)(object)clip) && reportedMissingClips.Add(clipName)) { loggedPose = pose; Plugin.Log.LogWarning((object)($"Gojo pose {pose} has no clip '{clipName}' " + "(rootBone=" + (Object.op_Implicit((Object)(object)rootBone) ? ((Object)rootBone).name : "none") + ").")); } if (!Object.op_Implicit((Object)(object)clip)) { return false; } clip.SampleAnimation(((Component)animator).gameObject, GetSampleTime(clip, pose, phase, strength)); RestoreRootAlignment(); if (!Object.op_Implicit((Object)(object)clearance)) { clearance = ((Component)animator).gameObject.AddComponent(); clearance.Resolve(((Component)animator).transform); } clearance.Apply(); return true; } catch (Exception exception) { DisableWithError("Direct Sett-rig animation sampling failed", exception); return false; } } private void EnsureInitialized() { if (ready || initializationAttempted) { return; } initializationAttempted = true; try { CharacterModel componentInParent = ((Component)this).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)componentInParent)) { throw new InvalidOperationException("CharacterModel is missing."); } Material val = FindCurrentGojoMaterial(); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("The current Gojo material is missing."); } BuildExactSettRig(componentInParent, val); ReplaceVisibleModel(componentInParent, val); ready = true; GojoExtraSkins.Apply(componentInParent, skinRenderer); Plugin.Log.LogInfo((object)("Gojo exact Sett-rig animation initialized on " + ((Object)this).name + ": " + $"{skinRenderer.bones.Length} native bones, " + $"{GojoHumanoidAnimationLibrary.ClipCount} clips, " + $"{skinRenderer.sharedMesh.vertexCount} vertices.")); } catch (Exception exception) { DisableWithError("Could not initialize the exact Gojo Sett rig", exception); } } private Material FindCurrentGojoMaterial() { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.sharedMaterial)) { return val.sharedMaterial; } } return null; } private void BuildExactSettRig(CharacterModel characterModel, Material material) { //IL_0062: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) GameObject sourcePrefab = GojoHumanoidAnimationLibrary.SourcePrefab; Mesh gojoMesh = GojoHumanoidAnimationLibrary.GojoMesh; if (!Object.op_Implicit((Object)(object)sourcePrefab) || !Object.op_Implicit((Object)(object)gojoMesh)) { throw new FileNotFoundException("The Sett source prefab or rigged Gojo mesh is missing."); } animatedModel = Object.Instantiate(sourcePrefab, ((Component)characterModel).transform, false); ((Object)animatedModel).name = "GojoExactSettRig"; ((Object)animatedModel).hideFlags = (HideFlags)52; animatedModel.transform.localPosition = Vector3.zero; animatedModel.transform.localRotation = Quaternion.identity; animatedModel.transform.localScale = Vector3.one; SetLayerRecursively(animatedModel.transform, ((Component)characterModel).gameObject.layer); Renderer[] componentsInChildren = animatedModel.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } skinRenderer = animatedModel.GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)skinRenderer)) { throw new InvalidDataException("The Sett prefab has no SkinnedMeshRenderer."); } if (skinRenderer.bones == null || skinRenderer.bones.Length != 137) { throw new InvalidDataException("Unexpected Sett skeleton size: " + $"{((skinRenderer.bones != null) ? skinRenderer.bones.Length : 0)}."); } Bounds localBounds = ((Renderer)skinRenderer).localBounds; skinRenderer.sharedMesh = gojoMesh; ((Renderer)skinRenderer).sharedMaterial = material; ((Renderer)skinRenderer).localBounds = localBounds; skinRenderer.quality = (SkinQuality)4; skinRenderer.updateWhenOffscreen = true; ((Renderer)skinRenderer).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)skinRenderer).receiveShadows = true; ((Renderer)skinRenderer).enabled = true; Collider[] componentsInChildren2 = animatedModel.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].enabled = false; } animator = animatedModel.GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)animator) || !Object.op_Implicit((Object)(object)animator.avatar) || !animator.avatar.isValid || !animator.avatar.isHuman) { throw new InvalidOperationException("The native Sett rig has no valid humanoid Animator."); } ((Behaviour)animator).enabled = false; animator.applyRootMotion = false; animator.runtimeAnimatorController = null; characterModelTransform = ((Component)characterModel).transform; animationRootTransform = ((Component)animator).transform; animationRootLocalPosition = animationRootTransform.localPosition; animationRootLocalRotation = animationRootTransform.localRotation; animationRootLocalScale = animationRootTransform.localScale; avatarRootPositionOffset = characterModelTransform.InverseTransformPoint(animator.rootPosition); avatarRootRotationOffset = Quaternion.Inverse(characterModelTransform.rotation) * animator.rootRotation; rootBone = animator.GetBoneTransform((HumanBodyBones)0); } private void RestoreRootAlignment() { //IL_002f: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)animator) && Object.op_Implicit((Object)(object)characterModelTransform) && Object.op_Implicit((Object)(object)animationRootTransform)) { animationRootTransform.localPosition = animationRootLocalPosition; animationRootTransform.localRotation = animationRootLocalRotation; animationRootTransform.localScale = animationRootLocalScale; animator.rootPosition = characterModelTransform.TransformPoint(avatarRootPositionOffset); animator.rootRotation = characterModelTransform.rotation * avatarRootRotationOffset; } } private void ReplaceVisibleModel(CharacterModel characterModel, Material material) { //IL_0064: 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_008f: 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) Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && (Object)(object)componentsInChildren[i] != (Object)(object)skinRenderer) { componentsInChildren[i].enabled = false; } } ((Component)this).GetComponent()?.ReplaceVisibleRenderers((Renderer[])(object)new Renderer[1] { (Renderer)skinRenderer }); characterModel.baseRendererInfos = (RendererInfo[])(object)new RendererInfo[1] { new RendererInfo { renderer = (Renderer)(object)skinRenderer, defaultMaterial = material, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false } }; characterModel.materialsDirty = true; characterModel.forceUpdate = true; } private static void SetLayerRecursively(Transform root, int layer) { ((Component)root).gameObject.layer = layer; for (int i = 0; i < root.childCount; i++) { SetLayerRecursively(root.GetChild(i), layer); } } internal static string GetClipName(GojoCpuPose pose) { switch (pose) { case GojoCpuPose.Lobby: return "model|Idle_Variant2_model"; case GojoCpuPose.Walk: return "model|Run_Base_model"; case GojoCpuPose.Sprint: return "model|Run_Haste_model"; case GojoCpuPose.Jump: case GojoCpuPose.Fall: case GojoCpuPose.Flight: return JujutsuConfig.AirborneClip.Value; case GojoCpuPose.PunchLeft: return "model|sett_attack1_model"; case GojoCpuPose.PunchRight: return "model|sett_attack2_model"; case GojoCpuPose.SpinKick: return "model|Spell4_Spin_model"; case GojoCpuPose.Red: case GojoCpuPose.Blue: return "model|Channel_model"; case GojoCpuPose.Purple: return "model|Channel_Wndup_model"; case GojoCpuPose.Heal: return "model|Recall_model"; case GojoCpuPose.Domain: return "model|Channel_Wndup_model"; default: return "model|Idle_Base_model"; } } internal static float GetSampleTime(AnimationClip clip, GojoCpuPose pose, float phase, float strength) { float num = Mathf.Max(0.01f, clip.length); switch (pose) { case GojoCpuPose.Idle: return Mathf.Repeat(Time.time * 0.72f, num); case GojoCpuPose.Lobby: return Mathf.Repeat(Time.time * 0.42f, num); case GojoCpuPose.Walk: return Mathf.Repeat(phase * 0.1f, num); case GojoCpuPose.Sprint: return Mathf.Repeat(phase * 0.1f, num); case GojoCpuPose.Jump: case GojoCpuPose.Fall: case GojoCpuPose.Flight: { float num2 = num * 0.5f; return num2 + Mathf.PingPong(Time.time * 0.48f, num2); } case GojoCpuPose.Red: case GojoCpuPose.Blue: return Mathf.Repeat(Time.time * 0.62f, num); default: return Mathf.Clamp01(phase) * Mathf.Max(0f, num - 0.0001f); } } private void DisableWithError(string message, Exception exception) { ready = false; if (Object.op_Implicit((Object)(object)skinRenderer)) { ((Renderer)skinRenderer).enabled = false; } if (!failureLogged) { failureLogged = true; Plugin.Log.LogError((object)(message + "; the safe static Gojo model remains active: " + exception)); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)animatedModel)) { Object.Destroy((Object)(object)animatedModel); } } } internal static class GojoHumanoidAnimationLibrary { private const string SourcePrefabPath = "assets/sett/model/sett.fbx"; private const string GojoMeshPath = "assets/skinmods/gojo/meshes/role_wutiaowu_qingnian_body.mesh"; private static readonly Dictionary clips = new Dictionary(StringComparer.Ordinal); private static AssetBundle animationBundle; private static AssetBundle skinBundle; private static GameObject sourcePrefab; private static Mesh gojoMesh; private static bool loadAttempted; internal static int ClipCount { get { EnsureLoaded(); return clips.Count; } } internal static GameObject SourcePrefab { get { EnsureLoaded(); return sourcePrefab; } } internal static Mesh GojoMesh { get { EnsureLoaded(); return gojoMesh; } } internal static AnimationClip GetClip(string clipName) { EnsureLoaded(); clips.TryGetValue(clipName, out var value); return value; } internal static List ClipNames() { EnsureLoaded(); List list = new List(clips.Keys); list.Sort(StringComparer.Ordinal); return list; } private static void EnsureLoaded() { if (loadAttempted) { return; } loadAttempted = true; string path = JujutsuAssetPaths.Find("assets"); animationBundle = LoadBundle(Path.Combine(path, "sett_animations.bundle"), "Sett animation"); skinBundle = LoadBundle(Path.Combine(path, "gojo_sett_skin.bundle"), "Gojo skin"); sourcePrefab = animationBundle.LoadAsset("assets/sett/model/sett.fbx"); gojoMesh = skinBundle.LoadAsset("assets/skinmods/gojo/meshes/role_wutiaowu_qingnian_body.mesh"); AnimationClip[] array = animationBundle.LoadAllAssets(); foreach (AnimationClip val in array) { if (Object.op_Implicit((Object)(object)val) && !clips.ContainsKey(((Object)val).name)) { clips.Add(((Object)val).name, val); } } } private static AssetBundle LoadBundle(string path, string description) { if (!File.Exists(path)) { throw new FileNotFoundException(description + " bundle is missing.", path); } AssetBundle obj = AssetBundle.LoadFromFile(path); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidDataException("Unity could not load the " + description + " bundle: " + path); } return obj; } } internal static class GojoImportedModel { private sealed class ModelData { internal string[] BoneNames; internal int[] ParentIndices; internal Vector3[] BonePositions; internal Quaternion[] BoneRotations; internal Vector3[] BoneScales; internal MeshData[] Meshes; } private sealed class MeshData { internal string Name; internal int MaterialIndex; internal Vector3[] Vertices; internal Vector3[] Normals; internal Vector2[] Uvs; internal int[] Triangles; internal int[] SkeletonIndices; internal Matrix4x4[] BindPoses; internal BoneWeight[] BoneWeights; } private const string ModelFileName = "gojo.model"; private const string TextureFileName = "gojo.png"; private static ModelData cachedModel; private static Texture2D cachedTexture; private static Material cachedTemplateMaterial; internal static bool Apply(GameObject prefab) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) try { CharacterModel componentInChildren = prefab.GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)componentInChildren)) { Plugin.Log.LogWarning((object)("CharacterModel was not found while applying Gojo model to " + ((Object)prefab).name + ".")); return false; } Renderer[] componentsInChildren = ((Component)componentInChildren).GetComponentsInChildren(true); ModelData modelData = LoadModel(); Texture2D val = LoadTexture(); Material val2 = FindTemplateMaterial(componentInChildren); if (modelData == null || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return false; } GameObject val3 = new GameObject("GojoImportedModel"); val3.layer = ((Component)componentInChildren).gameObject.layer; Transform transform = val3.transform; transform.SetParent(((Component)componentInChildren).transform, false); transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); transform.localScale = Vector3.one * 0.82f; List list = BuildStaticMeshes(modelData, transform, val2, val); if (list.Count != modelData.Meshes.Length || list.Count == 0) { Object.Destroy((Object)(object)val3); Plugin.Log.LogError((object)("Gojo static model validation failed for " + ((Object)prefab).name + "; the vanilla model was left visible.")); return false; } RendererInfo[] baseRendererInfos = componentInChildren.baseRendererInfos; foreach (RendererInfo val4 in baseRendererInfos) { if (Object.op_Implicit((Object)(object)val4.renderer)) { val4.renderer.enabled = false; } } componentInChildren.baseRendererInfos = list.ToArray(); componentInChildren.materialsDirty = true; componentInChildren.forceUpdate = true; GojoModelVisibilityController gojoModelVisibilityController = val3.AddComponent(); Renderer[] array = (Renderer[])(object)new Renderer[list.Count]; for (int j = 0; j < list.Count; j++) { array[j] = list[j].renderer; } gojoModelVisibilityController.Configure(componentsInChildren, array); val3.AddComponent(); val3.AddComponent().Configure(componentInChildren, null, null); val3.AddComponent(); Plugin.Log.LogInfo((object)("Applied the supplied Gojo fallback model to " + ((Object)prefab).name + ": " + $"{list.Count} static renderers, " + "legacy CPU skinning disabled, " + $"{componentsInChildren.Length} vanilla renderers hidden.")); return true; } catch (Exception arg) { Plugin.Log.LogError((object)$"Could not build imported Gojo model: {arg}"); return false; } } private static ModelData LoadModel() { //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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_036f: 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) if (cachedModel != null) { return cachedModel; } string text = JujutsuAssetPaths.Find("assets", "gojo.model"); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)("Gojo model data was not found: " + text)); return null; } using FileStream input = File.OpenRead(text); using BinaryReader binaryReader = new BinaryReader(input); byte[] array = new byte[8] { 71, 79, 74, 79, 77, 68, 76, 49 }; byte[] array2 = binaryReader.ReadBytes(array.Length); if (array2.Length != array.Length) { throw new InvalidDataException("Gojo model header is incomplete."); } for (int i = 0; i < array.Length; i++) { if (array2[i] != array[i]) { throw new InvalidDataException("Gojo model header is invalid."); } } int num = binaryReader.ReadInt32(); if (num != 1) { throw new InvalidDataException($"Unsupported Gojo model version {num}."); } int num2 = binaryReader.ReadInt32(); ModelData modelData = new ModelData { BoneNames = new string[num2], ParentIndices = new int[num2], BonePositions = (Vector3[])(object)new Vector3[num2], BoneRotations = (Quaternion[])(object)new Quaternion[num2], BoneScales = (Vector3[])(object)new Vector3[num2] }; for (int j = 0; j < num2; j++) { modelData.BoneNames[j] = binaryReader.ReadString(); modelData.ParentIndices[j] = binaryReader.ReadInt32(); modelData.BonePositions[j] = ReadVector3(binaryReader); modelData.BoneRotations[j] = ReadQuaternion(binaryReader); modelData.BoneScales[j] = ReadVector3(binaryReader); } int num3 = binaryReader.ReadInt32(); modelData.Meshes = new MeshData[num3]; for (int k = 0; k < num3; k++) { MeshData meshData = new MeshData { Name = binaryReader.ReadString(), MaterialIndex = binaryReader.ReadInt32() }; int num4 = binaryReader.ReadInt32(); meshData.Vertices = (Vector3[])(object)new Vector3[num4]; meshData.Normals = (Vector3[])(object)new Vector3[num4]; meshData.Uvs = (Vector2[])(object)new Vector2[num4]; for (int l = 0; l < num4; l++) { meshData.Vertices[l] = ReadVector3(binaryReader); meshData.Normals[l] = ReadVector3(binaryReader); meshData.Uvs[l] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); } int num5 = binaryReader.ReadInt32(); meshData.Triangles = new int[num5]; for (int m = 0; m < num5; m++) { meshData.Triangles[m] = binaryReader.ReadInt32(); } int num6 = binaryReader.ReadInt32(); meshData.SkeletonIndices = new int[num6]; meshData.BindPoses = (Matrix4x4[])(object)new Matrix4x4[num6]; for (int n = 0; n < num6; n++) { meshData.SkeletonIndices[n] = binaryReader.ReadInt32(); meshData.BindPoses[n] = ReadAssimpMatrix(binaryReader); } meshData.BoneWeights = (BoneWeight[])(object)new BoneWeight[num4]; for (int num7 = 0; num7 < num4; num7++) { BoneWeight val = default(BoneWeight); ((BoneWeight)(ref val)).boneIndex0 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex1 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex2 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex3 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).weight0 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight1 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight2 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight3 = binaryReader.ReadSingle(); BoneWeight val2 = val; meshData.BoneWeights[num7] = val2; } modelData.Meshes[k] = meshData; } cachedModel = modelData; return cachedModel; } private static Texture2D LoadTexture() { if (Object.op_Implicit((Object)(object)cachedTexture)) { return cachedTexture; } string text = JujutsuAssetPaths.Find("assets", "gojo.png"); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)("Gojo texture was not found: " + text)); return null; } Texture2D obj = JujutsuTextures.Load(text, "texGojoImported", (TextureWrapMode)0, sharpenAtAngles: true); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidDataException("Gojo texture could not be decoded."); } cachedTexture = obj; return cachedTexture; } private static Material FindTemplateMaterial(CharacterModel characterModel) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) RendererInfo[] baseRendererInfos = characterModel.baseRendererInfos; foreach (RendererInfo val in baseRendererInfos) { if (Object.op_Implicit((Object)(object)val.defaultMaterial)) { cachedTemplateMaterial = val.defaultMaterial; return cachedTemplateMaterial; } } return cachedTemplateMaterial; } private static Transform[] BuildSkeleton(ModelData modelData, Transform container) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) Transform[] array = (Transform[])(object)new Transform[modelData.BoneNames.Length]; for (int i = 0; i < array.Length; i++) { Transform transform = new GameObject(modelData.BoneNames[i]).transform; int num = modelData.ParentIndices[i]; transform.SetParent((num >= 0) ? array[num] : container, false); transform.localPosition = modelData.BonePositions[i]; transform.localRotation = modelData.BoneRotations[i]; transform.localScale = modelData.BoneScales[i]; array[i] = transform; } return array; } private static List BuildStaticMeshes(ModelData modelData, Transform container, Material template, Texture2D texture) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) List list = new List(modelData.Meshes.Length); for (int i = 0; i < modelData.Meshes.Length; i++) { MeshData meshData = modelData.Meshes[i]; ValidateStaticMesh(meshData); Mesh val = new Mesh { name = "meshGojo_" + meshData.Name, indexFormat = (IndexFormat)(meshData.Vertices.Length > 65535), vertices = meshData.Vertices, normals = meshData.Normals, uv = meshData.Uvs, triangles = meshData.Triangles }; val.RecalculateBounds(); Material val2 = Object.Instantiate(template); ((Object)val2).name = "matGojoImported_" + meshData.Name; ApplyTexture(val2, texture, meshData.Name); GameObject val3 = new GameObject(meshData.Name); val3.transform.SetParent(container, false); val3.AddComponent().sharedMesh = val; MeshRenderer val4 = val3.AddComponent(); ((Renderer)val4).sharedMaterial = val2; ((Renderer)val4).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)val4).receiveShadows = true; ((Renderer)val4).enabled = true; list.Add(new RendererInfo { renderer = (Renderer)(object)val4, defaultMaterial = val2, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }); } return list; } private static int AttachCpuSkinners(ModelData modelData, List rendererInfos) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = Mathf.Min(modelData.Meshes.Length, rendererInfos.Count); for (int i = 0; i < num2; i++) { MeshData meshData = modelData.Meshes[i]; if (meshData.SkeletonIndices != null && meshData.SkeletonIndices.Length != 0 && meshData.BoneWeights != null && meshData.BoneWeights.Length == meshData.Vertices.Length) { Renderer renderer = rendererInfos[i].renderer; MeshFilter val = (Object.op_Implicit((Object)(object)renderer) ? ((Component)renderer).GetComponent() : null); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.AddComponent().Configure(val, modelData.BoneNames, modelData.ParentIndices, modelData.BonePositions, modelData.BoneRotations, modelData.BoneScales, meshData.SkeletonIndices, meshData.BoneWeights, meshData.Vertices, meshData.Normals); num++; } } } return num; } private static List BuildSkinnedMeshes(ModelData modelData, Transform container, Transform[] skeleton, Material template, Texture2D texture) { //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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01ac: Unknown result type (might be due to invalid IL or missing references) List list = new List(modelData.Meshes.Length); for (int i = 0; i < modelData.Meshes.Length; i++) { MeshData meshData = modelData.Meshes[i]; ValidateStaticMesh(meshData); if (meshData.SkeletonIndices == null || meshData.SkeletonIndices.Length == 0 || meshData.BoneWeights == null || meshData.BoneWeights.Length != meshData.Vertices.Length) { throw new InvalidDataException("Gojo mesh " + meshData.Name + " does not contain a usable skin."); } Mesh val = new Mesh { name = "meshGojo_" + meshData.Name, indexFormat = (IndexFormat)(meshData.Vertices.Length > 65535), vertices = meshData.Vertices, normals = meshData.Normals, uv = meshData.Uvs, triangles = meshData.Triangles, boneWeights = meshData.BoneWeights }; Material val2 = Object.Instantiate(template); ((Object)val2).name = "matGojoImported_" + meshData.Name; ApplyTexture(val2, texture, meshData.Name); GameObject val3 = new GameObject(meshData.Name); Transform transform = val3.transform; transform.SetParent(container, false); Transform[] array = (Transform[])(object)new Transform[meshData.SkeletonIndices.Length]; Matrix4x4[] array2 = (Matrix4x4[])(object)new Matrix4x4[meshData.SkeletonIndices.Length]; for (int j = 0; j < meshData.SkeletonIndices.Length; j++) { int num = meshData.SkeletonIndices[j]; if ((uint)num >= (uint)skeleton.Length) { throw new InvalidDataException("Gojo mesh " + meshData.Name + " references missing bone " + $"{num}."); } array[j] = skeleton[num]; array2[j] = array[j].worldToLocalMatrix * transform.localToWorldMatrix; } val.bindposes = array2; val.RecalculateBounds(); SkinnedMeshRenderer val4 = val3.AddComponent(); val4.sharedMesh = val; val4.bones = array; val4.rootBone = skeleton[0]; ((Renderer)val4).sharedMaterial = val2; ((Renderer)val4).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)val4).receiveShadows = true; val4.quality = (SkinQuality)4; val4.updateWhenOffscreen = true; Bounds bounds = val.bounds; ((Bounds)(ref bounds)).Expand(3f); ((Renderer)val4).localBounds = bounds; ((Renderer)val4).enabled = true; list.Add(new RendererInfo { renderer = (Renderer)(object)val4, defaultMaterial = val2, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }); } return list; } private static void ValidateStaticMesh(MeshData mesh) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) if (mesh.Vertices == null || mesh.Vertices.Length == 0 || mesh.Triangles == null || mesh.Triangles.Length < 3 || mesh.Triangles.Length % 3 != 0) { throw new InvalidDataException("Gojo mesh " + mesh.Name + " does not contain valid geometry."); } for (int i = 0; i < mesh.Vertices.Length; i++) { Vector3 val = mesh.Vertices[i]; if (!IsFinite(val.x) || !IsFinite(val.y) || !IsFinite(val.z) || Mathf.Abs(val.x) > 20f || Mathf.Abs(val.y) > 20f || Mathf.Abs(val.z) > 20f) { throw new InvalidDataException($"Gojo mesh {mesh.Name} contains an unsafe vertex at index {i}."); } } for (int j = 0; j < mesh.Triangles.Length; j++) { if ((uint)mesh.Triangles[j] >= (uint)mesh.Vertices.Length) { throw new InvalidDataException("Gojo mesh " + mesh.Name + " contains an invalid triangle index."); } } } private static bool IsFinite(float value) { if (!float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } private static void ApplyTexture(Material material, Texture2D texture, string meshName) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) SetTextureIfPresent(material, "_NormalTex", null); SetTextureIfPresent(material, "_BumpMap", null); SetTextureIfPresent(material, "_EmTex", null); SetTextureIfPresent(material, "_EmissionMap", null); SetTextureIfPresent(material, "_DetailAlbedoMap", null); SetTextureIfPresent(material, "_DetailNormalMap", null); SetTextureIfPresent(material, "_MainTex", (Texture)(object)texture); SetTextureIfPresent(material, "_BaseColorMap", (Texture)(object)texture); SetColorIfPresent(material, "_Color", Color.white); SetColorIfPresent(material, "_MainColor", Color.white); SetColorIfPresent(material, "_EmissionColor", Color.black); SetColorIfPresent(material, "_EmColor", Color.black); material.DisableKeyword("_EMISSION"); material.DisableKeyword("_NORMALMAP"); if (material.HasProperty("_EmPower")) { material.SetFloat("_EmPower", 0f); } if (material.HasProperty("_NormalStrength")) { material.SetFloat("_NormalStrength", 0f); } if (material.HasProperty("_SpecularStrength")) { bool flag = meshName.Contains("eye") || meshName.Contains("jingkuang") || meshName.Contains("jingpian"); material.SetFloat("_SpecularStrength", flag ? 0.45f : 0.12f); } if (material.HasProperty("_Cull")) { material.SetFloat("_Cull", 0f); } if (material.HasProperty("_Cutoff")) { material.SetFloat("_Cutoff", 0f); } } private static void SetTextureIfPresent(Material material, string propertyName, Texture texture) { if (material.HasProperty(propertyName)) { material.SetTexture(propertyName, texture); } } private static void SetColorIfPresent(Material material, string propertyName, Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(propertyName)) { material.SetColor(propertyName, color); } } private static Vector3 ReadVector3(BinaryReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } private static Quaternion ReadQuaternion(BinaryReader reader) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } private static Matrix4x4 ReadAssimpMatrix(BinaryReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) return new Matrix4x4 { m00 = reader.ReadSingle(), m01 = reader.ReadSingle(), m02 = reader.ReadSingle(), m03 = reader.ReadSingle(), m10 = reader.ReadSingle(), m11 = reader.ReadSingle(), m12 = reader.ReadSingle(), m13 = reader.ReadSingle(), m20 = reader.ReadSingle(), m21 = reader.ReadSingle(), m22 = reader.ReadSingle(), m23 = reader.ReadSingle(), m30 = reader.ReadSingle(), m31 = reader.ReadSingle(), m32 = reader.ReadSingle(), m33 = reader.ReadSingle() }; } } internal sealed class GojoModelVisibilityController : MonoBehaviour { [SerializeField] private Renderer[] vanillaRenderers; [SerializeField] private Renderer[] gojoRenderers; [SerializeField] private Light[] vanillaLights; internal void Configure(Renderer[] renderers) { vanillaRenderers = renderers; ApplyVisibility(); } internal void Configure(Renderer[] renderers, Renderer[] visibleRenderers) { Configure(renderers, visibleRenderers, null); } internal void Configure(Renderer[] renderers, Renderer[] visibleRenderers, Light[] suppressedLights) { vanillaRenderers = renderers; gojoRenderers = visibleRenderers; vanillaLights = suppressedLights; ApplyVisibility(); } internal string DescribeState() { Renderer[] array = vanillaRenderers; string text = $"hiding {((array != null) ? array.Length : 0)} vanilla renderer(s) "; Light[] array2 = vanillaLights; return text + $"and {((array2 != null) ? array2.Length : 0)} light(s), " + "keeping " + Describe(gojoRenderers); } private static string Describe(Renderer[] renderers) { if (renderers == null || renderers.Length == 0) { return "nothing"; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < renderers.Length; i++) { if (stringBuilder.Length > 0) { stringBuilder.Append(", "); } stringBuilder.Append(Object.op_Implicit((Object)(object)renderers[i]) ? $"'{((Object)renderers[i]).name}' enabled={renderers[i].enabled}" : ""); } return $"{renderers.Length}: {stringBuilder}"; } internal void ReplaceVisibleRenderers(Renderer[] visibleRenderers) { if (gojoRenderers != null) { for (int i = 0; i < gojoRenderers.Length; i++) { if (Object.op_Implicit((Object)(object)gojoRenderers[i])) { gojoRenderers[i].enabled = false; } } } gojoRenderers = visibleRenderers; ApplyVisibility(); } private void Awake() { ApplyVisibility(); } private void LateUpdate() { ApplyVisibility(); } private void ApplyVisibility() { if (vanillaLights != null) { for (int i = 0; i < vanillaLights.Length; i++) { if (Object.op_Implicit((Object)(object)vanillaLights[i]) && ((Behaviour)vanillaLights[i]).enabled) { ((Behaviour)vanillaLights[i]).enabled = false; } } } if (vanillaRenderers != null) { for (int j = 0; j < vanillaRenderers.Length; j++) { if (Object.op_Implicit((Object)(object)vanillaRenderers[j])) { vanillaRenderers[j].enabled = false; } } } if (gojoRenderers == null) { return; } for (int k = 0; k < gojoRenderers.Length; k++) { if (Object.op_Implicit((Object)(object)gojoRenderers[k])) { gojoRenderers[k].enabled = true; } } } } internal sealed class GojoModelRetargeter : MonoBehaviour { private sealed class BoneLink { internal Transform Source; internal Transform Target; internal Quaternion RotationOffset; } [SerializeField] private Animator sourceAnimator; [SerializeField] private string[] targetNames; [SerializeField] private Transform[] targetBones; private readonly List links = new List(); private BoneLink hipsLink; private bool initialized; internal void Configure(Animator animator, string[] names, Transform[] bones) { sourceAnimator = animator; targetNames = names; targetBones = bones; } private void Start() { Initialize(); } private void Initialize() { //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) if (!initialized && Object.op_Implicit((Object)(object)sourceAnimator) && targetNames != null && targetBones != null) { Dictionary dictionary = new Dictionary(StringComparer.Ordinal); for (int i = 0; i < targetNames.Length; i++) { dictionary[targetNames[i]] = targetBones[i]; } AddLink(dictionary, "Bip001 Pelvis", (HumanBodyBones)0, isHips: true, (HumanBodyBones)55); AddLink(dictionary, "Bip001 Spine", (HumanBodyBones)7, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 Spine1", (HumanBodyBones)8, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 Spine2", (HumanBodyBones)54, isHips: false, (HumanBodyBones)8); AddLink(dictionary, "Bip001 Neck", (HumanBodyBones)9, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 Head", (HumanBodyBones)10, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Clavicle", (HumanBodyBones)11, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L UpperArm", (HumanBodyBones)13, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Forearm", (HumanBodyBones)15, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Hand", (HumanBodyBones)17, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Clavicle", (HumanBodyBones)12, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R UpperArm", (HumanBodyBones)14, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Forearm", (HumanBodyBones)16, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Hand", (HumanBodyBones)18, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Thigh", (HumanBodyBones)1, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Calf", (HumanBodyBones)3, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Foot", (HumanBodyBones)5, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 L Toe0", (HumanBodyBones)19, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Thigh", (HumanBodyBones)2, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Calf", (HumanBodyBones)4, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Foot", (HumanBodyBones)6, isHips: false, (HumanBodyBones)55); AddLink(dictionary, "Bip001 R Toe0", (HumanBodyBones)20, isHips: false, (HumanBodyBones)55); AddFingerLinks(dictionary, "Bip001 L ", left: true); AddFingerLinks(dictionary, "Bip001 R ", left: false); ScaleAndAlign(dictionary); for (int j = 0; j < links.Count; j++) { BoneLink boneLink = links[j]; boneLink.RotationOffset = Quaternion.Inverse(boneLink.Source.rotation) * boneLink.Target.rotation; } initialized = links.Count > 0; } } private void AddFingerLinks(Dictionary targets, string prefix, bool left) { HumanBodyBones[] array; if (!left) { array = new HumanBodyBones[15]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); } else { array = new HumanBodyBones[15]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); } HumanBodyBones[] array2 = (HumanBodyBones[])(object)array; string[] array3 = new string[15] { "Finger0", "Finger01", "Finger02", "Finger1", "Finger11", "Finger12", "Finger2", "Finger21", "Finger22", "Finger3", "Finger31", "Finger32", "Finger4", "Finger41", "Finger42" }; for (int i = 0; i < array3.Length; i++) { AddLink(targets, prefix + array3[i], array2[i], isHips: false, (HumanBodyBones)55); } } private void AddLink(Dictionary targets, string targetName, HumanBodyBones humanBone, bool isHips = false, HumanBodyBones fallback = (HumanBodyBones)55) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!targets.TryGetValue(targetName, out var value)) { return; } Transform sourceBone = GetSourceBone(humanBone); if (!Object.op_Implicit((Object)(object)sourceBone) && (int)fallback != 55) { sourceBone = GetSourceBone(fallback); } if (Object.op_Implicit((Object)(object)sourceBone)) { BoneLink item = new BoneLink { Source = sourceBone, Target = value }; links.Add(item); if (isHips) { hipsLink = item; } } } private Transform GetSourceBone(HumanBodyBones bone) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) try { return sourceAnimator.GetBoneTransform(bone); } catch { return null; } } private void ScaleAndAlign(Dictionary targets) { //IL_0140: 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_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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00bd: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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) if (hipsLink == null) { return; } Transform sourceBone = GetSourceBone((HumanBodyBones)10); Transform sourceBone2 = GetSourceBone((HumanBodyBones)5); Transform sourceBone3 = GetSourceBone((HumanBodyBones)6); targets.TryGetValue("Bip001 Head", out var value); targets.TryGetValue("Bip001 L Foot", out var value2); targets.TryGetValue("Bip001 R Foot", out var value3); if (Object.op_Implicit((Object)(object)sourceBone) && Object.op_Implicit((Object)(object)sourceBone2) && Object.op_Implicit((Object)(object)sourceBone3) && Object.op_Implicit((Object)(object)value) && Object.op_Implicit((Object)(object)value2) && Object.op_Implicit((Object)(object)value3)) { float num = (sourceBone2.position.y + sourceBone3.position.y) * 0.5f; float num2 = (value2.position.y + value3.position.y) * 0.5f; float num3 = Mathf.Abs(sourceBone.position.y - num); float num4 = Mathf.Abs(value.position.y - num2); if (num3 > 0.1f && num4 > 0.1f) { float num5 = Mathf.Clamp(num3 / num4, 0.45f, 1.6f); ((Component)this).transform.localScale = Vector3.one * num5; } } Transform transform = ((Component)this).transform; transform.position += hipsLink.Source.position - hipsLink.Target.position; } private void LateUpdate() { //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_0079: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { Initialize(); if (!initialized) { return; } } for (int i = 0; i < links.Count; i++) { BoneLink boneLink = links[i]; boneLink.Target.rotation = boneLink.Source.rotation * boneLink.RotationOffset; } if (hipsLink != null) { hipsLink.Target.position = hipsLink.Source.position; } } } internal static class GojoMixamoBinding { internal const string AnimationFileName = "gojo.anim"; private static readonly (string Mixamo, HumanBodyBones Human)[] Map = new(string, HumanBodyBones)[52] { ("mixamorig:Hips", (HumanBodyBones)0), ("mixamorig:Spine", (HumanBodyBones)7), ("mixamorig:Spine1", (HumanBodyBones)8), ("mixamorig:Spine2", (HumanBodyBones)54), ("mixamorig:Neck", (HumanBodyBones)9), ("mixamorig:Head", (HumanBodyBones)10), ("mixamorig:LeftShoulder", (HumanBodyBones)11), ("mixamorig:LeftArm", (HumanBodyBones)13), ("mixamorig:LeftForeArm", (HumanBodyBones)15), ("mixamorig:LeftHand", (HumanBodyBones)17), ("mixamorig:RightShoulder", (HumanBodyBones)12), ("mixamorig:RightArm", (HumanBodyBones)14), ("mixamorig:RightForeArm", (HumanBodyBones)16), ("mixamorig:RightHand", (HumanBodyBones)18), ("mixamorig:LeftUpLeg", (HumanBodyBones)1), ("mixamorig:LeftLeg", (HumanBodyBones)3), ("mixamorig:LeftFoot", (HumanBodyBones)5), ("mixamorig:LeftToeBase", (HumanBodyBones)19), ("mixamorig:RightUpLeg", (HumanBodyBones)2), ("mixamorig:RightLeg", (HumanBodyBones)4), ("mixamorig:RightFoot", (HumanBodyBones)6), ("mixamorig:RightToeBase", (HumanBodyBones)20), ("mixamorig:LeftHandThumb1", (HumanBodyBones)24), ("mixamorig:LeftHandThumb2", (HumanBodyBones)25), ("mixamorig:LeftHandThumb3", (HumanBodyBones)26), ("mixamorig:LeftHandIndex1", (HumanBodyBones)27), ("mixamorig:LeftHandIndex2", (HumanBodyBones)28), ("mixamorig:LeftHandIndex3", (HumanBodyBones)29), ("mixamorig:LeftHandMiddle1", (HumanBodyBones)30), ("mixamorig:LeftHandMiddle2", (HumanBodyBones)31), ("mixamorig:LeftHandMiddle3", (HumanBodyBones)32), ("mixamorig:LeftHandRing1", (HumanBodyBones)33), ("mixamorig:LeftHandRing2", (HumanBodyBones)34), ("mixamorig:LeftHandRing3", (HumanBodyBones)35), ("mixamorig:LeftHandPinky1", (HumanBodyBones)36), ("mixamorig:LeftHandPinky2", (HumanBodyBones)37), ("mixamorig:LeftHandPinky3", (HumanBodyBones)38), ("mixamorig:RightHandThumb1", (HumanBodyBones)39), ("mixamorig:RightHandThumb2", (HumanBodyBones)40), ("mixamorig:RightHandThumb3", (HumanBodyBones)41), ("mixamorig:RightHandIndex1", (HumanBodyBones)42), ("mixamorig:RightHandIndex2", (HumanBodyBones)43), ("mixamorig:RightHandIndex3", (HumanBodyBones)44), ("mixamorig:RightHandMiddle1", (HumanBodyBones)45), ("mixamorig:RightHandMiddle2", (HumanBodyBones)46), ("mixamorig:RightHandMiddle3", (HumanBodyBones)47), ("mixamorig:RightHandRing1", (HumanBodyBones)48), ("mixamorig:RightHandRing2", (HumanBodyBones)49), ("mixamorig:RightHandRing3", (HumanBodyBones)50), ("mixamorig:RightHandPinky1", (HumanBodyBones)51), ("mixamorig:RightHandPinky2", (HumanBodyBones)52), ("mixamorig:RightHandPinky3", (HumanBodyBones)53) }; private static Dictionary roleByName; internal static bool TryGetHumanBone(string mixamoName, out HumanBodyBones role) { //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_0041: Unknown result type (might be due to invalid IL or missing references) if (roleByName == null) { roleByName = new Dictionary(Map.Length, StringComparer.Ordinal); (string, HumanBodyBones)[] map = Map; for (int i = 0; i < map.Length; i++) { var (key, value) = map[i]; roleByName[key] = value; } } return roleByName.TryGetValue(mixamoName, out role); } internal static SukunaMixamoAnimationDriver Attach(Animator animator, GameObject host) { //IL_008c: 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) if (!Object.op_Implicit((Object)(object)host)) { return null; } if (!Object.op_Implicit((Object)(object)animator) || !Object.op_Implicit((Object)(object)animator.avatar) || !animator.avatar.isValid || !animator.avatar.isHuman) { Plugin.Log.LogWarning((object)("Gojo Mixamo binding skipped: no humanoid Avatar for " + ((Object)host).name + ".")); return null; } List list = new List(Map.Length); List list2 = new List(Map.Length); List list3 = new List(); for (int i = 0; i < Map.Length; i++) { Transform boneTransform = animator.GetBoneTransform(Map[i].Human); if (!Object.op_Implicit((Object)(object)boneTransform)) { list3.Add(((object)Unsafe.As(ref Map[i].Human)/*cast due to .constrained prefix*/).ToString()); continue; } list.Add(Map[i].Mixamo); list2.Add(boneTransform); } if (!list.Contains("mixamorig:Hips")) { Plugin.Log.LogWarning((object)"Gojo Mixamo binding skipped: the Avatar defines no Hips."); return null; } SukunaMixamoAnimationDriver sukunaMixamoAnimationDriver = host.AddComponent(); sukunaMixamoAnimationDriver.UseAnimationFile("gojo.anim"); sukunaMixamoAnimationDriver.UseSourceBasis(Quaternion.AngleAxis(-90f, Vector3.right)); sukunaMixamoAnimationDriver.UseHipsTranslation(follow: false); Quaternion[] restRotations = ReadRestPose(animator, host, list, list2); sukunaMixamoAnimationDriver.Configure(list.ToArray(), list2.ToArray(), restRotations); Plugin.Log.LogInfo((object)("Gojo Mixamo binding on " + ((Object)host).name + ": " + $"{list.Count} of {Map.Length} bones resolved" + ((list3.Count > 0) ? (", missing " + string.Join(", ", list3)) : "") + ".")); return sukunaMixamoAnimationDriver; } private static Quaternion[] ReadRestPose(Animator animator, GameObject host, List names, List bones) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) Quaternion[] array = (Quaternion[])(object)new Quaternion[bones.Count]; GameObject sourcePrefab = GojoHumanoidAnimationLibrary.SourcePrefab; Animator val = (Object.op_Implicit((Object)(object)sourcePrefab) ? sourcePrefab.GetComponentInChildren(true) : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)animator)) { Plugin.Log.LogWarning((object)"Gojo rest pose unavailable: the rig prefab has no Animator to measure from. Falling back to the bones as they stand, which is a frame of whatever is playing."); return array; } Dictionary dictionary = new Dictionary(StringComparer.Ordinal); Dictionary dictionary2 = new Dictionary(StringComparer.Ordinal); Walk(((Component)val).transform, Quaternion.identity, Vector3.zero, dictionary, dictionary2); Quaternion val2 = SukunaMixamoAnimationDriver.RelativeRotation(host.transform, ((Component)animator).transform); int num = 0; for (int i = 0; i < bones.Count; i++) { if (Object.op_Implicit((Object)(object)bones[i]) && dictionary.TryGetValue(((Object)bones[i]).name, out var value)) { array[i] = val2 * value; num++; } } int num2 = names.IndexOf("mixamorig:LeftArm"); string text = ((num2 >= 0 && Object.op_Implicit((Object)(object)bones[num2])) ? (" LeftArm rest=" + Describe(array[num2]) + " bone=" + Describe(SukunaMixamoAnimationDriver.RelativeRotation(host.transform, bones[num2]))) : string.Empty); Plugin.Log.LogInfo((object)("Gojo rest pose from prefab " + ((Object)sourcePrefab).name + " for " + ((Object)host).name + ": " + $"{num} of {bones.Count} bones." + text + DescribeArmSpread(names, bones, dictionary2))); return array; } private static void Walk(Transform node, Quaternion rotation, Vector3 position, Dictionary rotationByName, Dictionary positionByName) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0043: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!rotationByName.ContainsKey(((Object)node).name)) { rotationByName[((Object)node).name] = rotation; positionByName[((Object)node).name] = position; } for (int i = 0; i < node.childCount; i++) { Transform child = node.GetChild(i); Walk(child, rotation * child.localRotation, position + rotation * child.localPosition, rotationByName, positionByName); } } private static string DescribeArmSpread(List names, List bones, Dictionary restPositionByName) { //IL_006e: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) int num = names.IndexOf("mixamorig:LeftArm"); int num2 = names.IndexOf("mixamorig:LeftForeArm"); if (num < 0 || num2 < 0 || !Object.op_Implicit((Object)(object)bones[num]) || !Object.op_Implicit((Object)(object)bones[num2]) || !restPositionByName.TryGetValue(((Object)bones[num]).name, out var value) || !restPositionByName.TryGetValue(((Object)bones[num2]).name, out var value2)) { return string.Empty; } Vector3 val = value2 - value; int num3 = names.IndexOf("mixamorig:Hips"); int num4 = names.IndexOf("mixamorig:Head"); if (((Vector3)(ref val)).sqrMagnitude < 1E-08f || num3 < 0 || num4 < 0 || !Object.op_Implicit((Object)(object)bones[num3]) || !Object.op_Implicit((Object)(object)bones[num4]) || !restPositionByName.TryGetValue(((Object)bones[num3]).name, out var value3) || !restPositionByName.TryGetValue(((Object)bones[num4]).name, out var value4)) { return string.Empty; } Vector3 val2 = value3 - value4; if (((Vector3)(ref val2)).sqrMagnitude < 1E-08f) { return string.Empty; } return $" Rest upper arm {Vector3.Angle(val, val2):0} degrees " + "off straight down, against 37 in the clips."; } private static string Describe(Quaternion rotation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (rotation.x * rotation.x + rotation.y * rotation.y + rotation.z * rotation.z + rotation.w * rotation.w < 0.5f) { return "none"; } Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; return $"({eulerAngles.x:0}, {eulerAngles.y:0}, {eulerAngles.z:0})"; } } internal sealed class GojoModelAnimator : MonoBehaviour { private enum CombatAnimation { None, LeftPunch, RightPunch, SpinKick, Dismantle } private Transform modelRoot; private Transform animationReference; private CharacterBody body; private CharacterMotor motor; private InputBankTest inputBank; private CharacterDirection characterDirection; private EntityStateMachine bodyStateMachine; private EntityStateMachine weaponStateMachine; private GojoFlightController flightController; private Vector3 baseLocalPosition; private Quaternion baseLocalRotation; private Vector3 baseLocalScale; private Transform pelvis; private Transform spine; private Transform chest; private Transform head; private Transform leftUpperArm; private Transform leftForearm; private Transform rightUpperArm; private Transform rightForearm; private Transform leftThigh; private Transform leftCalf; private Transform rightThigh; private Transform rightCalf; private Transform leftToe; private Transform rightToe; private FootstepHandler vanillaFootsteps; private string footstepEvent; private string sprintFootstepEvent; private bool leftToeDown; private bool rightToeDown; private float lastFootstepTime; private Quaternion pelvisBaseRotation; private Quaternion spineBaseRotation; private Quaternion chestBaseRotation; private Quaternion headBaseRotation; private Quaternion leftUpperArmBaseRotation; private Quaternion leftForearmBaseRotation; private Quaternion rightUpperArmBaseRotation; private Quaternion rightForearmBaseRotation; private Quaternion leftThighBaseRotation; private Quaternion leftCalfBaseRotation; private Quaternion rightThighBaseRotation; private Quaternion rightCalfBaseRotation; private bool bonePoseCached; private GojoCpuSkinner[] cpuSkinners; private bool mixamoBindingAttempted; private Vector3 lastObservedPosition; private Vector3 observedVelocity; private bool hasObservedPosition; private GojoHumanoidAnimationDriver humanoidDriver; private GojoOutfitRig[] outfitRigs; private SukunaMixamoAnimationDriver sukunaMixamoDriver; private bool exactRigDrivenLastFrame; private SukunaSettAnimationDriver sukunaSettDriver; private const float FootPlantHeight = 0.11f; private const float FootLiftHeight = 0.19f; private const float MinimumFootstepInterval = 0.12f; private const float AirborneLift = 0f; private const float AirborneForward = 0f; private const float HoverVerticalAmplitude = 0.07f; private const float HoverVerticalRate = 0.9f; private const float HoverLateralAmplitude = 0.05f; private const float HoverLateralRate = 0.61f; private const float HoverRollAmplitude = 1.8f; private const float HoverRollRate = 0.47f; private const float FallYawCorrection = 10f; private const float SlashPoseHold = 0.2f; private CombatAnimation combatAnimation; private float attackAge = 100f; private float attackDuration = 0.4f; private float attackHitPhase = 0.5f; private int attackComboStep; private readonly HashSet reportedPunchSteps = new HashSet(); private readonly HashSet reportedPoseAnchors = new HashSet(); private float slashPoseHeldUntil; private Transform reportHead; private Transform reportPelvis; private bool nextPunchRight = true; private float airborneAge; private float groundedGraceRemaining; private float backwardIntentAge; private float smoothedMoveFraction; private float locomotionPhase; private float sprintBlend; private GojoCpuPose lowerBodyPose; private float lowerBodyStrength; private bool movingBackwardNow; private static readonly HashSet reportedPoseRoutes = new HashSet(); private bool UsesGojoMixamoSet { get { if (Object.op_Implicit((Object)(object)sukunaMixamoDriver)) { return sukunaMixamoDriver.IsGojoClipSet; } return false; } } private Vector3 ReferenceRight { get { //IL_0019: 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) if (!Object.op_Implicit((Object)(object)animationReference)) { return Vector3.right; } return animationReference.right; } } private Vector3 ReferenceUp { get { //IL_0019: 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) if (!Object.op_Implicit((Object)(object)animationReference)) { return Vector3.up; } return animationReference.up; } } private Vector3 ReferenceForward { get { //IL_0019: 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) if (!Object.op_Implicit((Object)(object)animationReference)) { return Vector3.forward; } return animationReference.forward; } } private void Start() { Configure(((Component)this).GetComponentInParent(), null, null); } internal static GojoModelAnimator Find(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } ModelLocator modelLocator = body.modelLocator; Transform val = (Object.op_Implicit((Object)(object)modelLocator) ? modelLocator.modelTransform : null); GojoModelAnimator gojoModelAnimator = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponentInChildren(true) : null); if (!Object.op_Implicit((Object)(object)gojoModelAnimator)) { return ((Component)body).GetComponentInChildren(true); } return gojoModelAnimator; } internal void TriggerPunch(bool rightHand, float duration, int comboStep = 0, float hitPhase = 0.5f) { combatAnimation = ((!rightHand) ? CombatAnimation.LeftPunch : CombatAnimation.RightPunch); attackDuration = Mathf.Max(0.1f, duration); attackHitPhase = Mathf.Clamp01(hitPhase); attackComboStep = Mathf.Clamp(comboStep, 0, 3); attackAge = 0f; if (reportedPunchSteps.Add(attackComboStep)) { Plugin.Log.LogInfo((object)($"Melee step {attackComboStep} triggered on " + (Object.op_Implicit((Object)(object)modelRoot) ? ((Object)modelRoot).name : ((Object)this).name) + ": " + $"{attackDuration:0.00}s, right={rightHand}.")); } } internal bool TriggerNextPunch(float duration) { bool flag = nextPunchRight; nextPunchRight = !nextPunchRight; TriggerPunch(flag, duration); return flag; } internal void TriggerDismantle(float duration) { combatAnimation = CombatAnimation.Dismantle; attackDuration = Mathf.Max(0.1f, duration); attackHitPhase = 0.5f; attackAge = 0f; } internal void TriggerSpinKick(float duration, float hitPhase = 0.48f) { combatAnimation = CombatAnimation.SpinKick; attackDuration = Mathf.Max(0.1f, duration); attackHitPhase = Mathf.Clamp01(hitPhase); attackAge = 0f; } internal void Configure(CharacterModel characterModel, string[] boneNames, Transform[] bones) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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) modelRoot = ((Component)this).transform; baseLocalPosition = modelRoot.localPosition; baseLocalRotation = modelRoot.localRotation; baseLocalScale = modelRoot.localScale; cpuSkinners = ((Component)this).GetComponentsInChildren(true); humanoidDriver = ((Component)this).GetComponent(); sukunaMixamoDriver = ((Component)this).GetComponent(); sukunaSettDriver = ((Component)this).GetComponent(); body = (Object.op_Implicit((Object)(object)characterModel) ? ((Component)characterModel).GetComponentInParent() : null); animationReference = (Object.op_Implicit((Object)(object)body) ? body.transform : (Object.op_Implicit((Object)(object)characterModel) ? ((Component)characterModel).transform : ((Component)this).transform.parent)); if (Object.op_Implicit((Object)(object)body)) { motor = ((Component)body).GetComponent(); inputBank = ((Component)body).GetComponent(); characterDirection = ((Component)body).GetComponent(); flightController = ((Component)body).GetComponent(); bodyStateMachine = EntityStateMachine.FindByCustomName(((Component)body).gameObject, "Body"); weaponStateMachine = EntityStateMachine.FindByCustomName(((Component)body).gameObject, "Weapon"); } if (boneNames == null || bones == null) { CacheBonesFromHierarchy(); TakeOverFootsteps(); return; } Dictionary dictionary = new Dictionary(StringComparer.Ordinal); int num = Mathf.Min(boneNames.Length, bones.Length); for (int i = 0; i < num; i++) { if (Object.op_Implicit((Object)(object)bones[i])) { dictionary[boneNames[i]] = bones[i]; } } CacheBones(dictionary); TakeOverFootsteps(); } private void TakeOverFootsteps() { if (Object.op_Implicit((Object)(object)leftToe) && Object.op_Implicit((Object)(object)rightToe)) { vanillaFootsteps = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)vanillaFootsteps)) { footstepEvent = vanillaFootsteps.baseFootstepString; sprintFootstepEvent = (string.IsNullOrEmpty(vanillaFootsteps.sprintFootstepOverrideString) ? footstepEvent : vanillaFootsteps.sprintFootstepOverrideString); vanillaFootsteps.baseFootstepString = string.Empty; vanillaFootsteps.sprintFootstepOverrideString = string.Empty; vanillaFootsteps.baseFootliftString = string.Empty; vanillaFootsteps.sprintFootliftOverrideString = string.Empty; Plugin.Log.LogInfo((object)("Footsteps moved onto the imported rig on " + ((Object)this).name + ": '" + footstepEvent + "' walking, '" + sprintFootstepEvent + "' sprinting.")); } } } private void UpdateFootsteps() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(footstepEvent) && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)motor) && Object.op_Implicit((Object)(object)leftToe) && Object.op_Implicit((Object)(object)rightToe)) { float y = body.footPosition.y; bool isGrounded = motor.isGrounded; Vector3 val = new Vector3(motor.velocity.x, 0f, motor.velocity.z); float magnitude = ((Vector3)(ref val)).magnitude; bool striding = isGrounded && magnitude > 1.5f; TrackToe(leftToe, y, striding, ref leftToeDown); TrackToe(rightToe, y, striding, ref rightToeDown); } } private void TrackToe(Transform toe, float ground, bool striding, ref bool down) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) float num = toe.position.y - ground; if (down) { if (num > 0.19f) { down = false; } } else if (!(num > 0.11f)) { down = true; if (striding && !(Time.time - lastFootstepTime < 0.12f)) { lastFootstepTime = Time.time; Util.PlaySound(body.isSprinting ? sprintFootstepEvent : footstepEvent, ((Component)body).gameObject); } } } private void CacheBonesFromHierarchy() { Dictionary dictionary = new Dictionary(StringComparer.Ordinal); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { dictionary[((Object)componentsInChildren[i]).name] = componentsInChildren[i]; } CacheBones(dictionary); } private void CacheBones(Dictionary lookup) { pelvis = FindBone(lookup, "Bip001 Pelvis", "root.x", "mixamorig:Hips"); spine = FindBone(lookup, "Bip001 Spine", "spine_str_cns_01.x", "mixamorig:Spine"); chest = FindBone(lookup, "Bip001 Spine2", "spine_str_cns_03.x", "spine_str_cns_02.x", "mixamorig:Spine2"); head = FindBone(lookup, "Bip001 Head", "head.x", "mixamorig:Head"); leftUpperArm = FindBone(lookup, "Bip001 L UpperArm", "arm_stretch.l", "mixamorig:LeftArm"); leftForearm = FindBone(lookup, "Bip001 L Forearm", "forearm_stretch.l", "mixamorig:LeftForeArm"); rightUpperArm = FindBone(lookup, "Bip001 R UpperArm", "arm_stretch.r", "mixamorig:RightArm"); rightForearm = FindBone(lookup, "Bip001 R Forearm", "forearm_stretch.r", "mixamorig:RightForeArm"); leftThigh = FindBone(lookup, "Bip001 L Thigh", "thigh_stretch.l", "mixamorig:LeftUpLeg"); leftCalf = FindBone(lookup, "Bip001 L Calf", "leg_stretch.l", "mixamorig:LeftLeg"); rightThigh = FindBone(lookup, "Bip001 R Thigh", "thigh_stretch.r", "mixamorig:RightUpLeg"); rightCalf = FindBone(lookup, "Bip001 R Calf", "leg_stretch.r", "mixamorig:RightLeg"); leftToe = FindBone(lookup, "mixamorig:LeftToeBase", "toes_01.l"); rightToe = FindBone(lookup, "mixamorig:RightToeBase", "toes_01.r"); CaptureBaseBonePose(); int num = (Object.op_Implicit((Object)(object)pelvis) ? 1 : 0) + (Object.op_Implicit((Object)(object)spine) ? 1 : 0) + (Object.op_Implicit((Object)(object)chest) ? 1 : 0) + (Object.op_Implicit((Object)(object)head) ? 1 : 0) + (Object.op_Implicit((Object)(object)leftUpperArm) ? 1 : 0) + (Object.op_Implicit((Object)(object)leftForearm) ? 1 : 0) + (Object.op_Implicit((Object)(object)rightUpperArm) ? 1 : 0) + (Object.op_Implicit((Object)(object)rightForearm) ? 1 : 0) + (Object.op_Implicit((Object)(object)leftThigh) ? 1 : 0) + (Object.op_Implicit((Object)(object)leftCalf) ? 1 : 0) + (Object.op_Implicit((Object)(object)rightThigh) ? 1 : 0) + (Object.op_Implicit((Object)(object)rightCalf) ? 1 : 0); Plugin.Log.LogInfo((object)("Runtime model animation fallback resolved " + $"{num}/12 major bones on {((Object)this).name}.")); } private static Transform FindBone(Dictionary lookup, params string[] names) { for (int i = 0; i < names.Length; i++) { if (lookup.TryGetValue(names[i], out var value) && Object.op_Implicit((Object)(object)value)) { return value; } } return null; } private void LateUpdate() { //IL_00a1: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0b7c: Unknown result type (might be due to invalid IL or missing references) //IL_0b81: Unknown result type (might be due to invalid IL or missing references) //IL_0b86: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b92: Unknown result type (might be due to invalid IL or missing references) //IL_0b97: Unknown result type (might be due to invalid IL or missing references) //IL_0b9e: Unknown result type (might be due to invalid IL or missing references) //IL_0ba3: Unknown result type (might be due to invalid IL or missing references) //IL_0ba8: Unknown result type (might be due to invalid IL or missing references) //IL_0bab: Unknown result type (might be due to invalid IL or missing references) //IL_0bb1: Unknown result type (might be due to invalid IL or missing references) //IL_0bb6: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0bcb: Unknown result type (might be due to invalid IL or missing references) //IL_0bd3: Unknown result type (might be due to invalid IL or missing references) //IL_0bd8: Unknown result type (might be due to invalid IL or missing references) //IL_0bdd: Unknown result type (might be due to invalid IL or missing references) //IL_0be2: Unknown result type (might be due to invalid IL or missing references) //IL_0be5: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) //IL_0bf1: 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_01b3: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0c27: Unknown result type (might be due to invalid IL or missing references) //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) //IL_0c30: Unknown result type (might be due to invalid IL or missing references) //IL_0c46: Unknown result type (might be due to invalid IL or missing references) //IL_0c4b: Unknown result type (might be due to invalid IL or missing references) //IL_0c4f: Unknown result type (might be due to invalid IL or missing references) //IL_0c65: Unknown result type (might be due to invalid IL or missing references) //IL_0c6a: Unknown result type (might be due to invalid IL or missing references) //IL_0c6e: Unknown result type (might be due to invalid IL or missing references) //IL_0378: 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_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)modelRoot)) { return; } float time = Time.time; float bob = (exactRigDrivenLastFrame ? 0f : (Mathf.Sin(time * 2.2f) * 0.012f)); float num = 0f; float num2 = 0f; float roll = 0f; float num3 = 0f; float lateralOffset = 0f; float num4 = 1f + Mathf.Sin(time * 2.2f) * 0.003f; GojoCpuPose gojoCpuPose = ((!Object.op_Implicit((Object)(object)body)) ? GojoCpuPose.Lobby : GojoCpuPose.Idle); float phase = time; float strength = 1f; ResetBaseBonePose(); ApplyNeutralStance(); RotateWorld(chest, ReferenceRight, Mathf.Sin(time * 2.2f) * 1.2f); if (!Object.op_Implicit((Object)(object)body)) { PoseLobby(time); if (!exactRigDrivenLastFrame) { bob = 0.025f + Mathf.Sin(time * 1.8f) * 0.018f; num2 = Mathf.Sin(time * 0.65f) * 3f; roll = Mathf.Sin(time * 0.9f) * 1.5f; } goto IL_0997; } Vector3 val = ResolveVelocity(); int num5; if (Object.op_Implicit((Object)(object)motor)) { num5 = (motor.isGrounded ? 1 : 0); if (num5 != 0) { groundedGraceRemaining = 0.24f; goto IL_018b; } } else { num5 = 0; } if (val.y > 2f) { groundedGraceRemaining = 0f; } else { groundedGraceRemaining = Mathf.Max(0f, groundedGraceRemaining - Time.deltaTime); } goto IL_018b; IL_018b: bool flag = num5 != 0 || groundedGraceRemaining > 0f || IsNearWalkableGround(val); Vector3 val2 = new Vector3(val.x, 0f, val.z); float num6 = Mathf.Clamp01(((Vector3)(ref val2)).magnitude / Mathf.Max(1f, body.moveSpeed)); float num7 = 1f - Mathf.Exp(-10f * Time.deltaTime); smoothedMoveFraction = Mathf.Lerp(smoothedMoveFraction, num6, num7); float num8 = smoothedMoveFraction; bool flag2 = Object.op_Implicit((Object)(object)flightController) && flightController.IsFlightActive; if (!flag || num8 <= 0.08f) { backwardIntentAge = 0f; } UpdateLowerBodyLayer(flag, flag2, num8); if (flag) { airborneAge = 0f; } else { airborneAge += Time.deltaTime; } IPosedState posedState = ChoosePosedState(); if (posedState != null) { gojoCpuPose = posedState.Pose; phase = posedState.PosePhase; bob = posedState.PoseBob; num = posedState.PosePitch; if (posedState.HoldsSlashPose) { slashPoseHeldUntil = time + 0.2f; } } else if (Object.op_Implicit((Object)(object)weaponStateMachine) && weaponStateMachine.state is IPurpleCastPose { DrivesPose: not false } purpleCastPose) { gojoCpuPose = GojoCpuPose.Purple; phase = purpleCastPose.AnimationPhase; float strength2 = 0.72f + Mathf.Sin(time * 2.4f) * 0.18f; bob = 0.07f + Mathf.Sin(time * 3f) * 0.04f; num = -15f; num4 = 1f + Mathf.Sin(time * 7f) * 0.012f; PoseTechniqueHands(strength2); RotateWorld(leftForearm, body.transform.up, Mathf.Sin(time * 3.2f) * 12f); RotateWorld(rightForearm, body.transform.up, (0f - Mathf.Sin(time * 3.2f)) * 12f); } else if (Object.op_Implicit((Object)(object)weaponStateMachine) && weaponStateMachine.state is ReversalRedState reversalRedState) { phase = reversalRedState.AnimationPhase; if (flag2) { gojoCpuPose = GojoCpuPose.FlightCast; ApplyHoverDrift(time, ref bob, ref lateralOffset, ref roll); num = -14f; } else { gojoCpuPose = GojoCpuPose.Red; bob = 0.045f + Mathf.Sin(time * 5f) * 0.025f; num = -10f; roll = -7f; PoseTechniqueArm(rightUpperArm, rightForearm, 1f); RotateWorld(rightForearm, body.transform.up, Mathf.Sin(time * 5f) * 14f); RotateWorld(chest, body.transform.up, -6f + Mathf.Sin(time * 3f) * 3f); } } else if (Object.op_Implicit((Object)(object)weaponStateMachine) && weaponStateMachine.state is LapseBlueState lapseBlueState) { phase = lapseBlueState.AnimationPhase; if (flag2) { gojoCpuPose = GojoCpuPose.FlightCast; ApplyHoverDrift(time, ref bob, ref lateralOffset, ref roll); num = -14f; } else { gojoCpuPose = GojoCpuPose.Blue; bob = 0.045f + Mathf.Sin(time * 5f) * 0.025f; num = -10f; roll = 7f; PoseTechniqueArm(leftUpperArm, leftForearm, -1f); RotateWorld(leftForearm, body.transform.up, (0f - Mathf.Sin(time * 5f)) * 14f); RotateWorld(chest, body.transform.up, 6f - Mathf.Sin(time * 3f) * 3f); } } else if (Object.op_Implicit((Object)(object)weaponStateMachine) && weaponStateMachine.state is DomainExpansionState domainExpansionState) { gojoCpuPose = GojoCpuPose.Domain; phase = domainExpansionState.AnimationPhase; if (!exactRigDrivenLastFrame) { bob = 0.1f + Mathf.Sin(time * 4f) * 0.035f; num = -16f; num2 = Mathf.Sin(time * 2.5f) * 8f; num4 = 1f + Mathf.Sin(time * 9f) * 0.015f; PoseDomainHands(); RotateWorld(head, body.transform.right, -8f + Mathf.Sin(time * 2f) * 3f); RotateWorld(chest, body.transform.up, Mathf.Sin(time * 2.5f) * 7f); } } else if (Object.op_Implicit((Object)(object)bodyStateMachine) && bodyStateMachine.state is InfinityState infinityState) { gojoCpuPose = GojoCpuPose.Heal; phase = infinityState.AnimationPhase; bob = Mathf.Sin(time * 2.5f) * 0.012f; PoseTechniqueHands(0.35f); RotateWorld(head, body.transform.right, -5f + Mathf.Sin(time * 2.2f) * 2f); } else if (flag2) { gojoCpuPose = GojoCpuPose.Flight; float num9 = Mathf.Clamp(val.y / Mathf.Max(1f, body.moveSpeed * 2.3f), -1f, 1f); ApplyHoverDrift(time, ref bob, ref lateralOffset, ref roll); num = -14f + num9 * 22f; if (!exactRigDrivenLastFrame) { PoseFlight(); } } else if (flag && num8 > 0.08f) { bool isSprinting = body.isSprinting; float num10 = locomotionPhase; if (Object.op_Implicit((Object)(object)humanoidDriver) || Object.op_Implicit((Object)(object)sukunaMixamoDriver)) { bob = 0f; num = 0f; num2 = 0f; roll = 0f; } else { bob = Mathf.Abs(Mathf.Sin(num10)) * 0.04f * num8; num = (isSprinting ? 13f : 4f) * num8; num2 = Mathf.Sin(num10 * 0.5f) * 3f * num8; roll = Mathf.Sin(num10) * (isSprinting ? 6f : 3f) * num8; } bool flag3 = movingBackwardNow; if (Object.op_Implicit((Object)(object)sukunaMixamoDriver) && flag3) { gojoCpuPose = GojoCpuPose.RunBackward; phase = num10; strength = num8; PoseWalking(num10, num8); } else if (isSprinting) { gojoCpuPose = GojoCpuPose.Sprint; phase = num10; strength = num8; PoseLocomotion(num10, num8, sprintBlend); } else { gojoCpuPose = GojoCpuPose.Walk; phase = num10; strength = num8; PoseLocomotion(num10, num8, sprintBlend); } } else if (!flag) { backwardIntentAge = 0f; if (Object.op_Implicit((Object)(object)sukunaMixamoDriver)) { gojoCpuPose = GojoCpuPose.Fall; phase = time; } else { gojoCpuPose = GojoCpuPose.Jump; phase = Mathf.Clamp01(airborneAge); } strength = Mathf.Clamp01(Mathf.Abs(val.y) / 8f); num = 0f; bob = 0f; num3 = 0f; if (Object.op_Implicit((Object)(object)humanoidDriver) || Object.op_Implicit((Object)(object)sukunaMixamoDriver)) { num2 = (UsesGojoMixamoSet ? 10f : 0f); roll = 0f; } PoseJump(val.y); } if (time < slashPoseHeldUntil && IsRestingPose(gojoCpuPose)) { gojoCpuPose = GojoCpuPose.Red; phase = 0f; } goto IL_0997; IL_0997: attackAge += Time.deltaTime; bool num11 = attackAge < attackDuration; float num12 = (num11 ? Mathf.Clamp01(attackAge / attackDuration) : 1f); if (num11) { if (combatAnimation == CombatAnimation.Dismantle) { gojoCpuPose = GojoCpuPose.Red; phase = num12; strength = 1f; } else if (combatAnimation == CombatAnimation.SpinKick) { gojoCpuPose = GojoCpuPose.SpinKick; phase = num12; strength = 1f; if (!exactRigDrivenLastFrame) { ApplySpinKickPose(num12); num2 += num12 * 360f; bob = Mathf.Max(bob, Mathf.Sin(num12 * MathF.PI) * 0.18f); } } else { float num13 = Mathf.Sin(num12 * MathF.PI); bool flag4 = combatAnimation == CombatAnimation.RightPunch; gojoCpuPose = (flag4 ? GojoCpuPose.PunchRight : GojoCpuPose.PunchLeft); phase = num12; strength = 1f; ApplyPunchPose(flag4, num12, num13); switch (attackComboStep) { case 1: num -= 10f * num13; num2 += (flag4 ? 1f : (-1f)) * 16f * num13; num3 = 0.12f * num13; break; case 2: num -= 30f * num13; num2 += (flag4 ? 1f : (-1f)) * 26f * num13; roll += (flag4 ? (-1f) : 1f) * 22f * num13; num3 = 0.4f * num13; bob = Mathf.Max(bob, num13 * 0.12f); break; default: num -= 16f * num13; num2 += (flag4 ? 1f : (-1f)) * 20f * num13; num3 = 0.26f * num13; break; } } } else { combatAnimation = CombatAnimation.None; } Vector3 val3 = baseLocalPosition + Vector3.up * bob + Vector3.forward * num3 + Vector3.right * lateralOffset; Quaternion val4 = baseLocalRotation * Quaternion.AngleAxis(num2, Vector3.forward) * Quaternion.AngleAxis(num, Vector3.right) * Quaternion.AngleAxis(0f - roll, Vector3.up); Vector3 val5 = baseLocalScale * num4; float num14 = ((combatAnimation == CombatAnimation.SpinKick) ? 1f : (1f - Mathf.Exp(-16f * Time.deltaTime))); modelRoot.localPosition = Vector3.Lerp(modelRoot.localPosition, val3, num14); modelRoot.localRotation = Quaternion.Slerp(modelRoot.localRotation, val4, num14); modelRoot.localScale = Vector3.Lerp(modelRoot.localScale, val5, num14); TryBindGojoMixamoSet(); bool flag5 = false; if (UsesGojoMixamoSet) { flag5 = sukunaMixamoDriver.ApplyPose(gojoCpuPose, phase, strength, attackComboStep, attackDuration, attackHitPhase, lowerBodyPose, locomotionPhase, lowerBodyStrength); } if (!flag5 && !UsesGojoMixamoSet && Object.op_Implicit((Object)(object)sukunaMixamoDriver) && sukunaMixamoDriver.HasAttackClip(gojoCpuPose)) { flag5 = sukunaMixamoDriver.ApplyPose(gojoCpuPose, phase, strength, attackComboStep, attackDuration, attackHitPhase, lowerBodyPose, locomotionPhase, lowerBodyStrength); } if (!flag5 && Object.op_Implicit((Object)(object)humanoidDriver)) { flag5 = humanoidDriver.ApplyPose(gojoCpuPose, phase, strength); } if (!flag5 && !UsesGojoMixamoSet && Object.op_Implicit((Object)(object)sukunaMixamoDriver)) { flag5 = sukunaMixamoDriver.ApplyPose(gojoCpuPose, phase, strength, attackComboStep, attackDuration, attackHitPhase, lowerBodyPose, locomotionPhase, lowerBodyStrength); } if (!flag5 && Object.op_Implicit((Object)(object)sukunaSettDriver)) { flag5 = sukunaSettDriver.ApplyPose(gojoCpuPose, phase, strength); } if (!flag5 && cpuSkinners != null) { for (int i = 0; i < cpuSkinners.Length; i++) { if (Object.op_Implicit((Object)(object)cpuSkinners[i])) { cpuSkinners[i].SetPose(gojoCpuPose, phase, strength); cpuSkinners[i].UpdateSkin(); } } } if (combatAnimation != CombatAnimation.None) { string item = combatAnimation.ToString() + "->" + gojoCpuPose; if (reportedPoseRoutes.Add(item)) { Plugin.Log.LogInfo((object)("Pose route on " + (Object.op_Implicit((Object)(object)modelRoot) ? ((Object)modelRoot).name : ((Object)this).name) + ": " + $"{combatAnimation} became {gojoCpuPose}, posed by " + (flag5 ? "an exact rig driver" : ((cpuSkinners != null && cpuSkinners.Length != 0) ? "the CPU skinner fallback" : "nothing at all")) + $" (age {attackAge:0.00} of {attackDuration:0.00}s, " + $"step {attackComboStep}).")); } } exactRigDrivenLastFrame = flag5; ReportPoseAnchor(gojoCpuPose, flag5); if (outfitRigs == null) { CharacterModel componentInParent = ((Component)this).GetComponentInParent(); outfitRigs = (Object.op_Implicit((Object)(object)componentInParent) ? ((Component)componentInParent).GetComponentsInChildren(true) : Array.Empty()); } bool authoredForSkin = Object.op_Implicit((Object)(object)sukunaMixamoDriver) && sukunaMixamoDriver.HasShinjukuFlight; GojoOutfitRig[] array = outfitRigs; foreach (GojoOutfitRig gojoOutfitRig in array) { if (Object.op_Implicit((Object)(object)gojoOutfitRig)) { gojoOutfitRig.SetPose(gojoCpuPose, authoredForSkin); gojoOutfitRig.Sync(); } } UpdateFootsteps(); } private void TryBindGojoMixamoSet() { if (!mixamoBindingAttempted && !Object.op_Implicit((Object)(object)sukunaMixamoDriver) && Object.op_Implicit((Object)(object)humanoidDriver) && humanoidDriver.IsReady) { mixamoBindingAttempted = true; sukunaMixamoDriver = GojoMixamoBinding.Attach(humanoidDriver.RigAnimator, ((Component)this).gameObject); } } private Vector3 ResolveVelocity() { //IL_0080: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_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_0138: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { if (!Object.op_Implicit((Object)(object)motor)) { return Vector3.zero; } return motor.velocity; } if (body.hasEffectiveAuthority) { lastObservedPosition = body.transform.position; hasObservedPosition = true; if (!Object.op_Implicit((Object)(object)motor)) { return Vector3.zero; } return motor.velocity; } Vector3 position = body.transform.position; if (!hasObservedPosition || Time.deltaTime <= 0f) { lastObservedPosition = position; hasObservedPosition = true; if (!Object.op_Implicit((Object)(object)motor)) { return Vector3.zero; } return motor.velocity; } Vector3 val = (position - lastObservedPosition) / Time.deltaTime; lastObservedPosition = position; observedVelocity = Vector3.Lerp(observedVelocity, val, 1f - Mathf.Exp(-12f * Time.deltaTime)); Vector3 result = observedVelocity; if (Object.op_Implicit((Object)(object)motor)) { result.y = motor.velocity.y; } return result; } private IPosedState ChoosePosedState() { IPosedState posedState = null; if (Object.op_Implicit((Object)(object)weaponStateMachine) && weaponStateMachine.state is IPosedState { DrivesPose: not false } posedState2) { posedState = posedState2; } if (Object.op_Implicit((Object)(object)bodyStateMachine) && bodyStateMachine.state is IPosedState { DrivesPose: not false } posedState3 && (posedState == null || posedState3.PosePriority > posedState.PosePriority)) { posedState = posedState3; } return posedState; } private bool IsNearWalkableGround(Vector3 velocity) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) if (!Object.op_Implicit((Object)(object)body) || velocity.y > 1.25f) { return false; } Vector3 val = body.footPosition + Vector3.up * 0.42f; float num = Mathf.Clamp(body.radius * 0.32f, 0.12f, 0.34f); RaycastHit val2 = default(RaycastHit); return Physics.SphereCast(val, num, Vector3.down, ref val2, 0.82f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } private void CaptureBaseBonePose() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) pelvisBaseRotation = GetLocalRotation(pelvis); spineBaseRotation = GetLocalRotation(spine); chestBaseRotation = GetLocalRotation(chest); headBaseRotation = GetLocalRotation(head); leftUpperArmBaseRotation = GetLocalRotation(leftUpperArm); leftForearmBaseRotation = GetLocalRotation(leftForearm); rightUpperArmBaseRotation = GetLocalRotation(rightUpperArm); rightForearmBaseRotation = GetLocalRotation(rightForearm); leftThighBaseRotation = GetLocalRotation(leftThigh); leftCalfBaseRotation = GetLocalRotation(leftCalf); rightThighBaseRotation = GetLocalRotation(rightThigh); rightCalfBaseRotation = GetLocalRotation(rightCalf); bonePoseCached = true; } private void UpdateLowerBodyLayer(bool grounded, bool flying, float moveFraction) { //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_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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_00ee: 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_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_0167: 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_014b: 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_0187: 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) bool flag = Object.op_Implicit((Object)(object)body) && body.isSprinting; sprintBlend = Mathf.MoveTowards(sprintBlend, flag ? 1f : 0f, Time.deltaTime / 0.2f); bool flag2 = grounded && !flying && moveFraction > 0.08f; if (flag2) { float num = Mathf.Lerp(Mathf.Lerp(5.5f, 8.5f, moveFraction), Mathf.Lerp(10f, 14f, moveFraction), sprintBlend); locomotionPhase = Mathf.Repeat(locomotionPhase + Time.deltaTime * num, MathF.PI * 200f); Vector3 val = (Object.op_Implicit((Object)(object)inputBank) ? Vector3.ProjectOnPlane(inputBank.moveVector, Vector3.up) : Vector3.ProjectOnPlane((!Object.op_Implicit((Object)(object)body)) ? Vector3.zero : (Object.op_Implicit((Object)(object)body.characterMotor) ? body.characterMotor.velocity : Vector3.zero), Vector3.up)); Vector3 val2 = (Object.op_Implicit((Object)(object)characterDirection) ? Vector3.ProjectOnPlane(characterDirection.forward, Vector3.up) : (Object.op_Implicit((Object)(object)body) ? Vector3.ProjectOnPlane(body.transform.forward, Vector3.up) : Vector3.forward)); bool flag3 = ((Vector3)(ref val)).sqrMagnitude > 0.01f && ((Vector3)(ref val2)).sqrMagnitude > 0.01f && Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized) < -0.72f; backwardIntentAge = (flag3 ? Mathf.Min(0.25f, backwardIntentAge + Time.deltaTime) : 0f); } movingBackwardNow = backwardIntentAge >= 0.1f; lowerBodyStrength = (flag2 ? moveFraction : 0f); lowerBodyPose = (flag2 ? ((Object.op_Implicit((Object)(object)sukunaMixamoDriver) && movingBackwardNow) ? GojoCpuPose.RunBackward : (flag ? GojoCpuPose.Sprint : GojoCpuPose.Walk)) : GojoCpuPose.Idle); } private void ResetBaseBonePose() { //IL_0010: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (bonePoseCached) { SetLocalRotation(pelvis, pelvisBaseRotation); SetLocalRotation(spine, spineBaseRotation); SetLocalRotation(chest, chestBaseRotation); SetLocalRotation(head, headBaseRotation); SetLocalRotation(leftUpperArm, leftUpperArmBaseRotation); SetLocalRotation(leftForearm, leftForearmBaseRotation); SetLocalRotation(rightUpperArm, rightUpperArmBaseRotation); SetLocalRotation(rightForearm, rightForearmBaseRotation); SetLocalRotation(leftThigh, leftThighBaseRotation); SetLocalRotation(leftCalf, leftCalfBaseRotation); SetLocalRotation(rightThigh, rightThighBaseRotation); SetLocalRotation(rightCalf, rightCalfBaseRotation); } } private void PoseWalking(float stride, float strength) { PoseLocomotion(stride, strength, 0f); } private void PoseLocomotion(float stride, float strength, float sprint) { //IL_003f: 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_0044: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0120: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) sprint = Mathf.Clamp01(sprint); float num = Mathf.Sin(stride) * strength; float num2 = Mathf.Sin(stride + MathF.PI / 2f) * strength; Vector3 axis = (Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right); Vector3 axis2 = (Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward); float num3 = Mathf.Lerp(24f, 46f, sprint); float num4 = Mathf.Lerp(30f, 58f, sprint); float num5 = Mathf.Lerp(20f, 42f, sprint); float num6 = Mathf.Lerp(0f, -30f, sprint); float num7 = Mathf.Lerp(-8f, -20f, sprint); RotateWorld(leftThigh, axis, num3 * num); RotateWorld(rightThigh, axis, (0f - num3) * num); RotateWorld(leftCalf, axis, Mathf.Max(0f, 0f - num2) * num4); RotateWorld(rightCalf, axis, Mathf.Max(0f, num2) * num4); RotateWorld(leftUpperArm, axis, (0f - num5) * num); RotateWorld(rightUpperArm, axis, num5 * num); RotateWorld(leftForearm, axis, num6 + num7 * Mathf.Abs(num)); RotateWorld(rightForearm, axis, num6 + num7 * Mathf.Abs(num)); RotateWorld(spine, axis, Mathf.Lerp(0f, 10f, sprint) * strength); RotateWorld(spine, axis2, Mathf.Lerp(3f, 7f, sprint) * num); } private void PoseLobby(float time) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0112: 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_013d: 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_0165: 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_018d: Unknown result type (might be due to invalid IL or missing references) Vector3 referenceRight = ReferenceRight; Vector3 referenceUp = ReferenceUp; Vector3 referenceForward = ReferenceForward; float num = Mathf.Sin(time * 1.8f); float num2 = Mathf.Sin(time * 0.7f); float num3 = Mathf.Repeat(time, 9f); float num4 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(2.2f, 3.2f, num3)); num4 *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(5.2f, 6.2f, num3)); RotateWorld(pelvis, referenceForward, 3f * num2); RotateWorld(spine, referenceRight, 2f * num); RotateWorld(chest, referenceUp, -4f * num2); RotateWorld(head, referenceUp, 7f * num2); RotateWorld(head, referenceRight, -2f + 2f * num); RotateWorld(leftUpperArm, referenceForward, 5f - 5f * num2); RotateWorld(rightUpperArm, referenceForward, -5f + 5f * num2); RotateWorld(leftForearm, referenceRight, -12f); RotateWorld(rightUpperArm, referenceRight, -58f * num4); RotateWorld(rightUpperArm, referenceForward, 22f * num4); RotateWorld(rightForearm, referenceRight, -45f * num4); RotateWorld(leftThigh, referenceRight, 4f * num2); RotateWorld(rightThigh, referenceRight, -4f * num2); } private void ApplyNeutralStance() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) RotateWorld(leftUpperArm, ReferenceForward, 42f); RotateWorld(rightUpperArm, ReferenceForward, -42f); RotateWorld(leftForearm, ReferenceRight, -12f); RotateWorld(rightForearm, ReferenceRight, -12f); RotateWorld(leftThigh, ReferenceForward, 2.5f); RotateWorld(rightThigh, ReferenceForward, -2.5f); } private void ReportPoseAnchor(GojoCpuPose pose, bool exactRigApplied) { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_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_0156: 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_019b: 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_01be: 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_01e1: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)modelRoot) || !reportedPoseAnchors.Add(pose)) { return; } if (!Object.op_Implicit((Object)(object)reportHead) || !Object.op_Implicit((Object)(object)reportPelvis)) { Animator val = ((Component)this).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)this).GetComponentInChildren(true); } if (Object.op_Implicit((Object)(object)val) && val.isHuman) { reportHead = val.GetBoneTransform((HumanBodyBones)10); reportPelvis = val.GetBoneTransform((HumanBodyBones)0); } } if (!Object.op_Implicit((Object)(object)reportHead)) { reportHead = FindBoneByName("mixamorig:Head", "head.x", "Bip001 Head"); } if (!Object.op_Implicit((Object)(object)reportPelvis)) { reportPelvis = FindBoneByName("mixamorig:Hips", "root.x", "Bip001 Pelvis"); } if (!Object.op_Implicit((Object)(object)reportHead)) { Plugin.Log.LogInfo((object)($"Pose anchor {pose} on {((Object)this).name}: no head bone found to " + "measure from.")); return; } Transform transform = body.transform; Vector3 val2 = transform.InverseTransformPoint(reportHead.position); Vector3 val3 = (Object.op_Implicit((Object)(object)reportPelvis) ? transform.InverseTransformPoint(reportPelvis.position) : Vector3.zero); Plugin.Log.LogInfo((object)($"Pose anchor {pose} on {((Object)this).name}: head=" + $"({val2.x:0.000}, {val2.y:0.000}, " + $"{val2.z:0.000}), pelvis=" + $"({val3.x:0.000}, {val3.y:0.000}, " + $"{val3.z:0.000}), root=" + $"({modelRoot.localPosition.x:0.000}, " + $"{modelRoot.localPosition.y:0.000}, " + $"{modelRoot.localPosition.z:0.000}), " + $"exactRig={exactRigApplied}.")); } private Transform FindBoneByName(params string[] names) { Transform[] componentsInChildren = ((Component)modelRoot).GetComponentsInChildren(true); for (int i = 0; i < names.Length; i++) { for (int j = 0; j < componentsInChildren.Length; j++) { if (Object.op_Implicit((Object)(object)componentsInChildren[j]) && string.Equals(((Object)componentsInChildren[j]).name, names[i], StringComparison.Ordinal)) { return componentsInChildren[j]; } } } return null; } private static bool IsRestingPose(GojoCpuPose pose) { if ((uint)pose <= 7u) { return true; } return false; } private void PoseJump(float verticalVelocity) { //IL_003a: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(verticalVelocity / 8f); float num2 = Mathf.Clamp01((0f - verticalVelocity) / 12f); Vector3 axis = (Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right); RotateWorld(leftThigh, axis, -18f * num + 12f * num2); RotateWorld(rightThigh, axis, 22f * num - 8f * num2); RotateWorld(leftCalf, axis, 32f * num); RotateWorld(rightCalf, axis, 18f * num); RotateWorld(leftUpperArm, axis, -24f * num); RotateWorld(rightUpperArm, axis, -24f * num); } private void ApplyPunchPose(bool right, float phase, float strike) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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) Transform target = (right ? rightUpperArm : leftUpperArm); Transform target2 = (right ? rightForearm : leftForearm); float num = (right ? 1f : (-1f)); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(phase * 2.4f)); float num3 = Mathf.Clamp01((phase - 0.65f) / 0.35f); num2 *= 1f - num3; RotateWorld(target, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -88f * num2); RotateWorld(target, Object.op_Implicit((Object)(object)body) ? body.transform.up : Vector3.up, num * 22f * strike); RotateWorld(target2, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -54f * (1f - num2) * strike); RotateWorld(chest, Object.op_Implicit((Object)(object)body) ? body.transform.up : Vector3.up, num * 16f * strike); Transform target3 = (right ? leftUpperArm : rightUpperArm); Transform target4 = (right ? leftForearm : rightForearm); RotateWorld(target3, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -30f * strike); RotateWorld(target4, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -55f * strike); } private void ApplySpinKickPose(float phase) { //IL_007c: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_015c: 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_0192: 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_01c8: 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) float num = Mathf.Clamp01(phase / 0.28f); float num2 = Mathf.Clamp01((phase - 0.18f) / 0.22f); float num3 = Mathf.Clamp01((phase - 0.72f) / 0.28f); float num4 = Mathf.Min(num2, 1f - num3); float num5 = Mathf.Sin(Mathf.Clamp01(phase * 1.25f) * MathF.PI); RotateWorld(rightThigh, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -92f * num4); RotateWorld(rightThigh, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, -32f * num4); RotateWorld(rightCalf, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, 72f * num * (1f - num4)); RotateWorld(leftThigh, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, 22f * num5); RotateWorld(chest, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, -18f * num5); RotateWorld(leftUpperArm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, -55f * num5); RotateWorld(rightUpperArm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, 55f * num5); } private void PoseTechniqueArm(Transform upperArm, Transform forearm, float side) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0080: 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) RotateWorld(upperArm, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -48f); RotateWorld(upperArm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, side * 22f); RotateWorld(forearm, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -28f); } private void PoseTechniqueHands(float strength) { PoseTechniqueArm(leftUpperArm, leftForearm, 0f - strength); PoseTechniqueArm(rightUpperArm, rightForearm, strength); } private void PoseDomainHands() { //IL_0025: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00c1: 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) RotateWorld(leftUpperArm, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -58f); RotateWorld(rightUpperArm, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -58f); RotateWorld(leftForearm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, -55f); RotateWorld(rightForearm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, 55f); } private static void ApplyHoverDrift(float time, ref float bob, ref float lateralOffset, ref float roll) { bob = Mathf.Sin(time * 0.9f) * 0.07f; lateralOffset = Mathf.Sin(time * 0.61f) * 0.05f; roll = Mathf.Sin(time * 0.47f) * 1.8f; } private void PoseFlight() { //IL_0025: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00c1: 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) RotateWorld(leftUpperArm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, -18f); RotateWorld(rightUpperArm, Object.op_Implicit((Object)(object)body) ? body.transform.forward : Vector3.forward, 18f); RotateWorld(leftThigh, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, 12f); RotateWorld(rightThigh, Object.op_Implicit((Object)(object)body) ? body.transform.right : Vector3.right, -12f); } private static void RotateWorld(Transform target, Vector3 axis, float angle) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)target) && Mathf.Abs(angle) > 0.01f) { target.rotation = Quaternion.AngleAxis(angle, ((Vector3)(ref axis)).normalized) * target.rotation; } } private static Quaternion GetLocalRotation(Transform target) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target)) { return Quaternion.identity; } return target.localRotation; } private static void SetLocalRotation(Transform target, Quaternion rotation) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)target)) { target.localRotation = rotation; } } } internal sealed class GojoOutfitRig : MonoBehaviour { private Transform[] proxies; private Transform[] sources; private Quaternion[] offsets; private int root; private Transform rigLeftFoot; private Transform rigRightFoot; private Transform outfitLeftFoot; private Transform outfitRightFoot; private GojoArmClearance clearance; private string label = "outfit"; private GojoCpuPose pose; private bool poseAuthoredForSkin; private GojoCpuPose reportedPose = (GojoCpuPose)(-1); private bool reportedMatched; private bool reportedLeftAlone; private int headBone = -1; private int leftHandBone = -1; private int rightHandBone = -1; private bool armBonesResolved; internal Transform[] Bones => proxies; internal Transform Root { get { if (proxies == null || root >= proxies.Length || !Object.op_Implicit((Object)(object)proxies[root])) { return ((Component)this).transform; } return proxies[root]; } } internal void Configure(Transform[] bones, Transform[] settBones, Quaternion[] boneOffsets, int rootBone, Transform rigLeft, Transform rigRight, Transform outfitLeft, Transform outfitRight) { proxies = bones; sources = settBones; offsets = boneOffsets; root = rootBone; rigLeftFoot = rigLeft; rigRightFoot = rigRight; outfitLeftFoot = outfitLeft; outfitRightFoot = outfitRight; Sync(); } internal void Sync() { //IL_0034: 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_005b: Unknown result type (might be due to invalid IL or missing references) if (proxies == null) { return; } for (int i = 0; i < proxies.Length; i++) { Transform val = proxies[i]; Transform val2 = sources[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2)) { val.rotation = val2.rotation * offsets[i]; if (i == root) { val.position = val2.position; } } } PlantFeet(); bool flag = pose == GojoCpuPose.Flight || pose == GojoCpuPose.FlightCast; if (flag && poseAuthoredForSkin) { ReportPath(matched: false, leftAlone: true); return; } bool flag2 = flag && MatchHandsToRig(); if (!flag2) { ClearArms(); } ReportPath(flag2, leftAlone: false); } internal void SetPose(GojoCpuPose value, bool authoredForSkin = false) { pose = value; poseAuthoredForSkin = authoredForSkin; } private void ReportPath(bool matched, bool leftAlone) { if (matched != reportedMatched || leftAlone != reportedLeftAlone || pose != reportedPose) { reportedMatched = matched; reportedLeftAlone = leftAlone; reportedPose = pose; Plugin.Log.LogInfo((object)($"Gojo outfit hands [{label}]: {pose} -> " + (matched ? "matched to the rig" : (leftAlone ? "left alone, the pose is this skin's own" : "clearance only")) + ".")); } } private bool MatchHandsToRig() { //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_00cc: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!ResolveArmBones()) { return false; } Transform val = proxies[headBone]; Transform val2 = sources[headBone]; if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return false; } Vector3 sideways = Vector3.zero; float num = ((JujutsuConfig.GojoOutfitHandSideways != null) ? JujutsuConfig.GojoOutfitHandSideways.Value : 0f); if (Mathf.Abs(num) > 0.0001f) { Transform val3 = UpperArm(leftHandBone); Transform val4 = UpperArm(rightHandBone); if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val4)) { Vector3 val5 = val4.position - val3.position; if (((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { sideways = ((Vector3)(ref val5)).normalized * num; } } } return MatchHand(leftHandBone, val, val2, sideways) | MatchHand(rightHandBone, val, val2, sideways); } private Transform UpperArm(int handIndex) { if (handIndex < 0 || !Object.op_Implicit((Object)(object)proxies[handIndex])) { return null; } Transform val = proxies[handIndex]; if (!Object.op_Implicit((Object)(object)val.parent)) { return null; } return val.parent.parent; } private bool MatchHand(int index, Transform outfitHead, Transform rigHead, Vector3 sideways) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00bf: Unknown result type (might be due to invalid IL or missing references) if (index < 0) { return false; } Transform val = proxies[index]; Transform val2 = sources[index]; if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { return false; } Transform val3 = (Object.op_Implicit((Object)(object)val.parent) ? val.parent.parent : null); if (!Object.op_Implicit((Object)(object)val3)) { return false; } Vector3 val4 = outfitHead.position + (val2.position - rigHead.position) + sideways; Vector3 val5 = val.position - val3.position; Vector3 val6 = val4 - val3.position; if (((Vector3)(ref val5)).sqrMagnitude < 1E-06f || ((Vector3)(ref val6)).sqrMagnitude < 1E-06f) { return false; } val3.rotation = Quaternion.FromToRotation(val5, val6) * val3.rotation; return true; } private bool ResolveArmBones() { if (armBonesResolved) { if (headBone >= 0) { if (leftHandBone < 0) { return rightHandBone >= 0; } return true; } return false; } armBonesResolved = true; if (proxies == null || sources == null) { return false; } for (int i = 0; i < proxies.Length && i < sources.Length; i++) { if (Object.op_Implicit((Object)(object)proxies[i])) { string text = ((Object)proxies[i]).name; int num = text.LastIndexOf(':'); if (num >= 0 && num + 1 < text.Length) { text = text.Substring(num + 1); } if (headBone < 0 && text.Equals("Head", StringComparison.OrdinalIgnoreCase)) { headBone = i; } else if (leftHandBone < 0 && text.Equals("LeftHand", StringComparison.OrdinalIgnoreCase)) { leftHandBone = i; } else if (rightHandBone < 0 && text.Equals("RightHand", StringComparison.OrdinalIgnoreCase)) { rightHandBone = i; } } } Plugin.Log.LogInfo((object)("Gojo outfit hands [" + label + "]: head " + ((headBone >= 0) ? ((Object)proxies[headBone]).name : "missing") + ", hands " + ((leftHandBone >= 0) ? ((Object)proxies[leftHandBone]).name : "missing") + " / " + ((rightHandBone >= 0) ? ((Object)proxies[rightHandBone]).name : "missing") + " — " + ((headBone >= 0 && (leftHandBone >= 0 || rightHandBone >= 0)) ? "matching the rig" : "falling back to clearance") + ".")); if (headBone >= 0) { if (leftHandBone < 0) { return rightHandBone >= 0; } return true; } return false; } private void ClearArms() { if (!Object.op_Implicit((Object)(object)clearance)) { Transform val = Root; if (!Object.op_Implicit((Object)(object)val)) { return; } clearance = ((Component)this).gameObject.AddComponent(); clearance.Label = label; clearance.Resolve(val); } clearance.Apply(); } internal void SetLabel(string name) { label = name; if (Object.op_Implicit((Object)(object)clearance)) { clearance.Label = name; } } private void PlantFeet() { //IL_005f: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)rigLeftFoot) && Object.op_Implicit((Object)(object)rigRightFoot) && Object.op_Implicit((Object)(object)outfitLeftFoot) && Object.op_Implicit((Object)(object)outfitRightFoot) && root < proxies.Length && Object.op_Implicit((Object)(object)proxies[root])) { float num = (rigLeftFoot.position.y + rigRightFoot.position.y) * 0.5f; float num2 = (outfitLeftFoot.position.y + outfitRightFoot.position.y) * 0.5f; Transform obj = proxies[root]; obj.position += Vector3.up * (num - num2); } } private void LateUpdate() { Sync(); } } internal enum GojoTechniqueStyle { Red, Blue, Purple, Slash, Impact, Swap } internal static class GojoTechniqueVisuals { internal static RuntimeTechniqueBurstVisual CreateBurst(Vector3 position, Color color, float radius, float duration, GojoTechniqueStyle style, Vector3 facing = default(Vector3)) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) GameObject val = new GameObject("Gojo" + style.ToString() + "EnergyField"); val.transform.position = position; RuntimeTechniqueBurstVisual runtimeTechniqueBurstVisual = val.AddComponent(); runtimeTechniqueBurstVisual.Initialize(color, radius, duration, style, facing); return runtimeTechniqueBurstVisual; } internal static void AddOrbOrnaments(GameObject orb, Color color, float trailTime) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)orb)) { orb.AddComponent().Initialize(color, trailTime); } } } internal sealed class RuntimeOrbOrnament : MonoBehaviour { private const int RingSegments = 48; private readonly List materials = new List(); private LineRenderer[] rings; private TrailRenderer[] trails; private Renderer auraRenderer; private Material auraMaterial; private Color color; private float age; internal void Initialize(Color tint, float trailTime) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) color = tint; BuildAura(); BuildRings(); if (trailTime > 0.01f) { BuildTrails(trailTime); } } private void BuildAura() { //IL_0005: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) GameObject val = JujutsuPrimitives.Sphere("TechniqueOuterAura", Vector3.zero, ownMaterial: false); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = Vector3.zero; val.transform.localScale = Vector3.one * 1.34f; auraRenderer = val.GetComponent(); JujutsuFxMaterials.PrepareRenderer(auraRenderer); Color colour = color; colour.a = 0.18f; auraMaterial = JujutsuFxMaterials.CreateSurfaceMaterial("matGojoTechniqueAura", colour); JujutsuFxMaterials.ConfigureTransparent(auraMaterial); materials.Add(auraMaterial); auraRenderer.material = auraMaterial; } private void BuildRings() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0069: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) rings = (LineRenderer[])(object)new LineRenderer[3]; Color colour = Color.Lerp(color, Color.white, 0.2f); colour.a = 0.82f; Material val = JujutsuFxMaterials.CreateLineMaterial("matGojoTechniqueOrbits", colour); materials.Add(val); for (int i = 0; i < rings.Length; i++) { GameObject val2 = new GameObject("TechniqueOrbit_" + i); val2.transform.SetParent(((Component)this).transform, false); LineRenderer val3 = val2.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3); val3.useWorldSpace = false; val3.loop = true; val3.positionCount = 48; val3.numCornerVertices = 2; val3.widthMultiplier = 0.035f + (float)i * 0.012f; Color val4 = Color.Lerp(color, Color.white, (i == 1) ? 0.42f : 0.12f); val4.a = 0.82f; val3.startColor = val4; val3.endColor = val4; ((Renderer)val3).material = val; float num = 0.68f + (float)i * 0.095f; for (int j = 0; j < 48; j++) { float num2 = (float)j / 48f * MathF.PI * 2f; val3.SetPosition(j, new Vector3(Mathf.Cos(num2) * num, 0f, Mathf.Sin(num2) * num)); } val2.transform.localRotation = Quaternion.Euler(32f + (float)i * 51f, (float)i * 37f, 18f + (float)i * 43f); rings[i] = val3; } } private void BuildTrails(float trailTime) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0068: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) trails = (TrailRenderer[])(object)new TrailRenderer[3]; Color colour = Color.Lerp(color, Color.white, 0.18f); colour.a = 0.88f; Material val = JujutsuFxMaterials.CreateLineMaterial("matGojoTechniqueTrails", colour); materials.Add(val); for (int i = 0; i < trails.Length; i++) { GameObject val2 = new GameObject("TechniqueTrail_" + i); val2.transform.SetParent(((Component)this).transform, false); float num = (float)i / (float)trails.Length * MathF.PI * 2f; val2.transform.localPosition = new Vector3(Mathf.Cos(num) * 0.24f, Mathf.Sin(num) * 0.24f, 0f); TrailRenderer val3 = val2.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3); val3.time = trailTime * (1f + (float)i * 0.15f); val3.minVertexDistance = 0.12f; val3.numCornerVertices = 3; val3.numCapVertices = 3; val3.autodestruct = false; val3.widthMultiplier = 0.28f; Color val4 = Color.Lerp(color, Color.white, (i == 1) ? 0.48f : 0.1f); val4.a = 0.9f; Color endColor = val4; endColor.a = 0f; val3.startColor = val4; val3.endColor = endColor; ((Renderer)val3).material = val; trails[i] = val3; } } private void Update() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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_0095: 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_0106: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float num = 1f + Mathf.Sin(age * 12f) * 0.055f; if (Object.op_Implicit((Object)(object)auraRenderer)) { ((Component)auraRenderer).transform.localScale = Vector3.one * (1.3f * num); Color colour = color; colour.a = 0.12f + (Mathf.Sin(age * 9f) + 1f) * 0.045f; JujutsuFxMaterials.SetTint(auraMaterial, colour, 1.45f); } if (rings != null) { for (int i = 0; i < rings.Length; i++) { if (Object.op_Implicit((Object)(object)rings[i])) { float num2 = ((i % 2 == 0) ? 1f : (-1f)); ((Component)rings[i]).transform.Rotate(new Vector3(11f + (float)i * 3f, num2 * (42f + (float)i * 17f), 7f), Time.deltaTime, (Space)1); rings[i].widthMultiplier = (0.035f + (float)i * 0.012f) * (1f + Mathf.Sin(age * 8f + (float)i) * 0.25f); } } } if (trails == null) { return; } float num3 = Mathf.Clamp(((Component)this).transform.localScale.x, 0.2f, 10f); for (int j = 0; j < trails.Length; j++) { if (Object.op_Implicit((Object)(object)trails[j])) { trails[j].widthMultiplier = num3 * (0.22f + (float)j * 0.045f); } } } private void OnDestroy() { for (int i = 0; i < materials.Count; i++) { if (Object.op_Implicit((Object)(object)materials[i])) { Object.Destroy((Object)(object)materials[i]); } } materials.Clear(); } } internal sealed class RuntimeTechniqueBurstVisual : MonoBehaviour { private const int RingSegments = 64; private const int PathSegments = 12; private readonly List materials = new List(); private LineRenderer[] rings; private LineRenderer[] energyPaths; private Material ringMaterial; private Material pathMaterial; private Color ringBaseColor; private Color pathBaseColor; private Light energyLight; private float lightIntensity; private Color color; private GojoTechniqueStyle style; private float radius; private float duration; private float age; internal void Initialize(Color tint, float effectRadius, float lifetime, GojoTechniqueStyle techniqueStyle, Vector3 facing = default(Vector3)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) color = tint; style = techniqueStyle; radius = Mathf.Max(1f, effectRadius); duration = Mathf.Max(0.18f, lifetime); if (style != GojoTechniqueStyle.Impact && ((Vector3)(ref facing)).sqrMagnitude > 0.0001f) { ((Component)this).transform.rotation = Quaternion.LookRotation(((Vector3)(ref facing)).normalized, Vector3.up); } BuildRings(); BuildEnergyPaths(); BuildLight(); } private void BuildRings() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_01c0: 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_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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) int num = style switch { GojoTechniqueStyle.Purple => 5, GojoTechniqueStyle.Slash => 4, GojoTechniqueStyle.Impact => 4, GojoTechniqueStyle.Swap => 4, _ => 3, }; rings = (LineRenderer[])(object)new LineRenderer[num]; Color colour = Color.Lerp(color, Color.white, 0.18f); colour.a = 0.88f; ringBaseColor = colour; Material val = (ringMaterial = JujutsuFxMaterials.CreateLineMaterial("matGojo" + style.ToString() + "BurstRings", colour)); materials.Add(val); for (int i = 0; i < num; i++) { GameObject val2 = new GameObject(style.ToString() + "BurstRing_" + i); val2.transform.SetParent(((Component)this).transform, false); LineRenderer val3 = val2.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3); val3.useWorldSpace = false; val3.loop = true; val3.positionCount = 64; val3.numCornerVertices = 3; val3.numCapVertices = 3; Color val4 = Color.Lerp(color, (i % 2 == 0) ? Color.white : Color.black, (i % 2 == 0) ? 0.34f : 0.18f); val4.a = 0.88f; val3.startColor = val4; val3.endColor = val4; ((Renderer)val3).material = val; Transform transform = ((Component)val3).transform; transform.localRotation = (Quaternion)(style switch { GojoTechniqueStyle.Slash => Quaternion.Euler(0f, 0f, 28f + (float)i * 47f), GojoTechniqueStyle.Impact => Quaternion.identity, GojoTechniqueStyle.Swap => Quaternion.Euler(0f, 0f, (float)i * 12f), _ => Quaternion.Euler((float)i * 37f, (float)i * 61f, (float)i * 23f), }); rings[i] = val3; } } private void BuildEnergyPaths() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_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_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) int num = style switch { GojoTechniqueStyle.Red => 22, GojoTechniqueStyle.Blue => 14, GojoTechniqueStyle.Slash => 16, GojoTechniqueStyle.Impact => 28, GojoTechniqueStyle.Swap => 20, _ => 26, }; energyPaths = (LineRenderer[])(object)new LineRenderer[num]; Color colour = Color.Lerp(color, Color.white, 0.12f); colour.a = 0.9f; pathBaseColor = colour; Material val = (pathMaterial = JujutsuFxMaterials.CreateLineMaterial("matGojo" + style.ToString() + "EnergyPaths", colour)); materials.Add(val); for (int i = 0; i < num; i++) { GameObject val2 = new GameObject(style.ToString() + "EnergyPath_" + i); val2.transform.SetParent(((Component)this).transform, false); LineRenderer val3 = val2.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val3); val3.useWorldSpace = false; val3.positionCount = 12; val3.numCornerVertices = 2; val3.numCapVertices = 2; Color val4 = Color.Lerp(color, Color.white, (float)(i % 4) * 0.11f); val4.a = 0.9f; val3.startColor = val4; val3.endColor = val4; ((Renderer)val3).material = val; energyPaths[i] = val3; } } private void BuildLight() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) lightIntensity = ((style == GojoTechniqueStyle.Purple) ? 8.5f : 6.5f); energyLight = JujutsuFxLights.TryAddMinor(((Component)this).gameObject, color, lightIntensity, radius * 1.35f, radius); } private void Update() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float num = Mathf.Clamp01(age / duration); float num2 = Mathf.Clamp01(age / 0.12f); float num3 = Mathf.Clamp01((duration - age) / 0.38f); float num4 = Mathf.Min(num2, num3); UpdateRings(num, num4); UpdatePaths(num, num4); JujutsuFxMaterials.SetEnvelope(ringMaterial, ringBaseColor, num4); JujutsuFxMaterials.SetEnvelope(pathMaterial, pathBaseColor, num4); if (Object.op_Implicit((Object)(object)energyLight)) { energyLight.intensity = lightIntensity * num4 * (1f + Mathf.Sin(age * 19f) * 0.16f); } if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void UpdateRings(float normalized, float alpha) { //IL_017b: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033a: 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_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) if (rings == null) { return; } for (int i = 0; i < rings.Length; i++) { LineRenderer val = rings[i]; if (Object.op_Implicit((Object)(object)val)) { float num = Mathf.Repeat(normalized * ((style == GojoTechniqueStyle.Blue) ? (-1.4f) : 1f) + (float)i * 0.12f, 1f); float num2 = style switch { GojoTechniqueStyle.Blue => radius * Mathf.Lerp(1.05f, 0.08f, num), GojoTechniqueStyle.Red => radius * Mathf.SmoothStep(0.05f, 1.18f, num), GojoTechniqueStyle.Slash => radius * Mathf.SmoothStep(0.12f, 1.24f, num), GojoTechniqueStyle.Impact => radius * Mathf.Sqrt(Mathf.Clamp01(num)) * 1.22f, GojoTechniqueStyle.Swap => radius * Mathf.Lerp(0.42f, 1.05f, num), _ => radius * Mathf.Lerp(0.2f, 1.12f, num) * (1f + Mathf.Sin(age * 7f + (float)i) * 0.08f), }; val.widthMultiplier = Mathf.Lerp(0.7f, 0.08f, num) * Mathf.Lerp(0.65f, 1.2f, radius / 20f) * alpha; Color val2 = Color.Lerp(color, Color.white, (i % 2 == 0) ? 0.28f : 0.04f); val2.a = alpha * (1f - num * 0.65f); val.startColor = val2; val.endColor = val2; float num3 = radius * 0.025f * Mathf.Sin(age * 8f + (float)i); float num4 = ((i % 2 == 0) ? 1f : (-1f)) * radius * 0.62f * (1f - Mathf.SmoothStep(0f, 1f, num)); for (int j = 0; j < 64; j++) { float num5 = (float)j / 64f * MathF.PI * 2f; float num6 = Mathf.Cos(num5); float num7 = Mathf.Sin(num5); val.SetPosition(j, (Vector3)(style switch { GojoTechniqueStyle.Slash => new Vector3(num6 * num2, num7 * num2 * 0.26f, Mathf.Sin(num5 * 2f + age * 6f) * num3), GojoTechniqueStyle.Impact => new Vector3(num6 * num2, Mathf.Sin(num5 * 4f + age * 3f) * num3 * 0.6f, num7 * num2), GojoTechniqueStyle.Swap => new Vector3(num6 * num2, num7 * num2, num4 + Mathf.Sin(num5 * 3f + age * 5f) * num3), _ => new Vector3(num6 * num2, Mathf.Sin(num5 * 3f + age * 5f) * num3, num7 * num2), })); } if (style == GojoTechniqueStyle.Red || style == GojoTechniqueStyle.Blue || style == GojoTechniqueStyle.Purple) { ((Component)val).transform.localRotation = Quaternion.Euler((float)i * 31f + age * 14f, (float)i * 47f - age * 21f, (float)i * 19f + age * 9f); } } } } private void UpdatePaths(float normalized, float alpha) { //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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_036e: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: 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_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_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_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) if (energyPaths == null) { return; } for (int i = 0; i < energyPaths.Length; i++) { LineRenderer val = energyPaths[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } float num = (float)i * 2.39996f; Vector3 val2; Vector3 val3; switch (style) { case GojoTechniqueStyle.Slash: val2 = new Vector3(Mathf.Cos(num * 2f), Mathf.Sin(num * 2f) * 0.45f, 0f); val3 = ((Vector3)(ref val2)).normalized; break; case GojoTechniqueStyle.Impact: val2 = new Vector3(Mathf.Cos(num), 0.16f + Mathf.Abs(Mathf.Sin(num * 1.7f)) * 0.2f, Mathf.Sin(num)); val3 = ((Vector3)(ref val2)).normalized; break; case GojoTechniqueStyle.Swap: val2 = new Vector3(Mathf.Cos(num), Mathf.Sin(num), Mathf.Sin(num * 3.1f) * 0.18f); val3 = ((Vector3)(ref val2)).normalized; break; default: val2 = new Vector3(Mathf.Cos(num), Mathf.Sin(num * 1.73f) * 0.72f, Mathf.Sin(num)); val3 = ((Vector3)(ref val2)).normalized; break; } Vector3 val4 = val3; Vector3 val5 = Vector3.Cross(val4, Vector3.up); if (((Vector3)(ref val5)).sqrMagnitude < 0.01f) { val5 = Vector3.right; } ((Vector3)(ref val5)).Normalize(); val3 = Vector3.Cross(val5, val4); Vector3 normalized2 = ((Vector3)(ref val3)).normalized; for (int j = 0; j < 12; j++) { float num2 = (float)j / 11f; Vector3 val6; if (style == GojoTechniqueStyle.Blue) { float num3 = Mathf.Lerp(1f, 0.04f, num2); float num4 = num + num2 * MathF.PI * 3.6f + age * 5.5f; val6 = new Vector3(Mathf.Cos(num4), Mathf.Sin(num4 * 0.47f) * 0.34f, Mathf.Sin(num4)) * radius * num3; } else { bool flag = style == GojoTechniqueStyle.Red || style == GojoTechniqueStyle.Slash || style == GojoTechniqueStyle.Impact || style == GojoTechniqueStyle.Swap; float num5 = (flag ? Mathf.SmoothStep(0f, 1f, normalized) : Mathf.Repeat(normalized * 1.35f + (float)i * 0.037f, 1f)); float num6 = style switch { GojoTechniqueStyle.Slash => 1.45f, GojoTechniqueStyle.Impact => 0.82f, GojoTechniqueStyle.Swap => 1.1f, _ => 1.16f, }; float num7 = radius * (flag ? (Mathf.Lerp(0.08f, num6, num5) * num2) : Mathf.Lerp(0.12f, 1.05f, num2)); float num8 = Mathf.Sin(num2 * MathF.PI * 8f + num * 3f + age * 15f) * radius * ((style == GojoTechniqueStyle.Purple) ? 0.055f : 0.025f); val6 = val4 * num7 + val5 * num8 + normalized2 * Mathf.Cos(num2 * 17f + num + age * 11f) * num8 * 0.65f; } val.SetPosition(j, val6); } Color val7 = Color.Lerp(color, Color.white, (i % 5 == 0) ? 0.55f : 0.08f); val7.a = alpha * (0.72f + (float)(i % 3) * 0.1f); val.startColor = val7; Color endColor = val7; endColor.a *= ((style == GojoTechniqueStyle.Blue) ? 0.12f : 0f); val.endColor = endColor; val.widthMultiplier = radius * ((style == GojoTechniqueStyle.Purple) ? 0.025f : 0.018f) * alpha * (0.7f + (float)(i % 4) * 0.12f); } } private void OnDestroy() { for (int i = 0; i < materials.Count; i++) { if (Object.op_Implicit((Object)(object)materials[i])) { Object.Destroy((Object)(object)materials[i]); } } materials.Clear(); } } internal interface IPosedState { bool DrivesPose { get; } GojoCpuPose Pose { get; } float PosePhase { get; } float PoseBob { get; } float PosePitch { get; } bool HoldsSlashPose { get; } int PosePriority { get; } } internal static class JujutsuBones { private static readonly string[] LeftNames = new string[3] { "mixamorig:LeftHand", "Bip001 L Hand", "Bip001 LeftHand" }; private static readonly string[] RightNames = new string[3] { "mixamorig:RightHand", "Bip001 R Hand", "Bip001 RightHand" }; internal static bool TryFindHands(CharacterBody body, out Transform left, out Transform right) { left = null; right = null; if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator)) { return false; } Transform modelTransform = body.modelLocator.modelTransform; if (!Object.op_Implicit((Object)(object)modelTransform)) { return false; } JujutsuHandCache jujutsuHandCache = ((Component)modelTransform).GetComponent(); if (!Object.op_Implicit((Object)(object)jujutsuHandCache)) { jujutsuHandCache = ((Component)modelTransform).gameObject.AddComponent(); jujutsuHandCache.Left = Locate(modelTransform, LeftNames, "LeftHand", "L Hand"); jujutsuHandCache.Right = Locate(modelTransform, RightNames, "RightHand", "R Hand"); Report(body, jujutsuHandCache); } left = jujutsuHandCache.Left; right = jujutsuHandCache.Right; if (Object.op_Implicit((Object)(object)left)) { return Object.op_Implicit((Object)(object)right); } return false; } private static Transform Locate(Transform model, string[] exactNames, params string[] looseNames) { Animator componentInChildren = ((Component)model).GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.isHuman) { Transform boneTransform = componentInChildren.GetBoneTransform((HumanBodyBones)((exactNames == LeftNames) ? 17 : 18)); if (Object.op_Implicit((Object)(object)boneTransform)) { return boneTransform; } } Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren(true); for (int i = 0; i < exactNames.Length; i++) { for (int j = 0; j < componentsInChildren.Length; j++) { if (Object.op_Implicit((Object)(object)componentsInChildren[j]) && ((Object)componentsInChildren[j]).name == exactNames[i]) { return componentsInChildren[j]; } } } Transform val = null; for (int k = 0; k < componentsInChildren.Length; k++) { if (!Object.op_Implicit((Object)(object)componentsInChildren[k])) { continue; } string name = ((Object)componentsInChildren[k]).name; bool flag = false; for (int l = 0; l < looseNames.Length; l++) { if (name.IndexOf(looseNames[l], StringComparison.OrdinalIgnoreCase) >= 0) { flag = true; break; } } if (flag && (!Object.op_Implicit((Object)(object)val) || name.Length < ((Object)val).name.Length)) { val = componentsInChildren[k]; } } return val; } private static void Report(CharacterBody body, JujutsuHandCache cache) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)(((Object)body).name + " hands: " + (Object.op_Implicit((Object)(object)cache.Left) ? ((Object)cache.Left).name : "none") + " / " + (Object.op_Implicit((Object)(object)cache.Right) ? ((Object)cache.Right).name : "none") + ".")); } } } internal sealed class JujutsuHandCache : MonoBehaviour { internal Transform Left; internal Transform Right; } [DefaultExecutionOrder(500)] internal sealed class JujutsuFootPlanting : MonoBehaviour { private struct Leg { internal Transform Upper; internal Transform Knee; internal Transform Foot; internal float Offset; internal Quaternion Tilt; internal float BendSign; internal Vector3 KneeSide; internal bool Valid { get { if (Object.op_Implicit((Object)(object)Upper) && Object.op_Implicit((Object)(object)Knee)) { return Object.op_Implicit((Object)(object)Foot); } return false; } } } private const float ProbeUp = 0.75f; private const float ProbeDown = 1.4f; private const float MaxPelvisDrop = 0.6f; private const float MaxFootSpreadShare = 0.55f; private const float FootSpreadFadeShare = 0.35f; private const float Responsiveness = 14f; private const float WeightSpeed = 7f; private const float MaxTilt = 45f; private const float MaxAnkleRoll = 14f; private const float MaxReachShare = 0.5f; private const float BendSwitchMargin = 0.7f; private CharacterBody body; private CharacterMotor motor; private Transform hips; private Leg left; private Leg right; private bool resolved; private bool gaveUp; private float nextSearchAt; private int attempts; private static readonly string[][] BoneNames = new string[8][] { new string[2] { "Hips", "Bip001 Pelvis" }, new string[2] { "LeftUpLeg", "Bip001 L Thigh" }, new string[2] { "LeftLeg", "Bip001 L Calf" }, new string[2] { "LeftFoot", "Bip001 L Foot" }, new string[2] { "RightUpLeg", "Bip001 R Thigh" }, new string[2] { "RightLeg", "Bip001 R Calf" }, new string[2] { "RightFoot", "Bip001 R Foot" }, new string[2] { "LeftToeBase", "Bip001 L Toe0" } }; private const float SearchInterval = 0.5f; private const int SearchAttempts = 30; private float weight; private float spread = 1f; private float appliedDrop; private const float KneeSideFloor = 0.0004f; private const int InversionReports = 5; private static int reportedInversions; private int traced; private const int TraceFrames = 120; private const float WalkingShare = 0.75f; private const float RunningShare = 1.45f; private float Applied => weight * spread; private static void ReportInversion(Transform upper) { if (reportedInversions < 5) { reportedInversions++; Plugin.Log.LogInfo((object)("Foot planting caught an inverted knee on " + (Object.op_Implicit((Object)(object)upper) ? ((Object)upper).name : "a leg") + " and turned it back.")); } } private void Awake() { //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_0043: 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) body = ((Component)this).GetComponentInParent(); motor = (Object.op_Implicit((Object)(object)body) ? body.characterMotor : null); left.Tilt = Quaternion.identity; right.Tilt = Quaternion.identity; left.BendSign = 1f; right.BendSign = 1f; } private void LateUpdate() { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) if (!resolved) { Resolve(); if (!resolved) { return; } } float num = ((Object.op_Implicit((Object)(object)motor) && motor.isGrounded) ? Settling() : 0f); weight = Mathf.MoveTowards(weight, num, 7f * Time.deltaTime); if (weight <= 0.001f) { return; } float ground; Vector3 normal; bool num2 = Probe(left, out ground, out normal); float ground2; Vector3 normal2; bool flag = Probe(right, out ground2, out normal2); if (!num2 || !flag) { Relax(); return; } float baseline = Mathf.Min(ground, ground2); float num3 = Mathf.Abs(ground - ground2); float num4 = Mathf.Max(LegLength(left), LegLength(right)); float num5 = ((num4 > 0.0001f) ? (1f - Mathf.Clamp01((num3 / num4 - 0.35f) / Mathf.Max(0.0001f, 0.20000002f))) : 1f); spread = Mathf.MoveTowards(spread, num5, 7f * Time.deltaTime); if (Applied <= 0.001f) { Relax(); return; } float num6 = Mathf.Max(LegLength(left), LegLength(right)); float num7 = (0f - Mathf.Min(num3 * 0.5f, Mathf.Min(0.6f, num6 * 0.5f * 0.5f))) * Applied; Transform obj = hips; obj.position += Vector3.up * (num7 - appliedDrop); appliedDrop = num7; PlantFoot(ref left, ground, baseline, num7, normal); PlantFoot(ref right, ground2, baseline, num7, normal2); Trace(ground, ground2, num7, normal, normal2); } private void Trace(float leftGround, float rightGround, float drop, Vector3 leftNormal, Vector3 rightNormal) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) if (traced < 120 && Object.op_Implicit((Object)(object)motor)) { Vector3 velocity = motor.velocity; velocity.y = 0f; if (!(((Vector3)(ref velocity)).magnitude > 0.5f)) { traced++; Plugin.Log.LogInfo((object)($"Foot trace {traced:000}: groundL={leftGround:0.0000} " + $"groundR={rightGround:0.0000} drop={drop:0.0000} " + $"offL={left.Offset:0.0000} offR={right.Offset:0.0000} " + $"weight={weight:0.000} spread={spread:0.000} " + $"tiltL={Vector3.Angle(Vector3.up, leftNormal):0.00} " + $"tiltR={Vector3.Angle(Vector3.up, rightNormal):0.00} " + $"kneeL={left.Knee.position.y:0.0000} " + $"kneeR={right.Knee.position.y:0.0000}")); } } } private float Settling() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)motor) || !Object.op_Implicit((Object)(object)body)) { return 1f; } Vector3 velocity = motor.velocity; velocity.y = 0f; float num = Mathf.Max(1f, body.moveSpeed); float num2 = ((Vector3)(ref velocity)).magnitude / num; return 1f - Mathf.Clamp01((num2 - 0.75f) / Mathf.Max(0.01f, 0.70000005f)); } private static float LegLength(Leg leg) { //IL_0015: 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_0030: 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) if (!leg.Valid) { return 0f; } return Vector3.Distance(leg.Upper.position, leg.Knee.position) + Vector3.Distance(leg.Knee.position, leg.Foot.position); } private void Relax() { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hips) && appliedDrop != 0f) { Transform obj = hips; obj.position -= Vector3.up * appliedDrop; appliedDrop = 0f; } left.Offset = Mathf.MoveTowards(left.Offset, 0f, 14f * Time.deltaTime); right.Offset = Mathf.MoveTowards(right.Offset, 0f, 14f * Time.deltaTime); } private bool Probe(Leg leg, out float ground, out Vector3 normal) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) ground = 0f; normal = Vector3.up; if (!leg.Valid) { return false; } RaycastHit val = default(RaycastHit); if (!Physics.Raycast(leg.Foot.position + Vector3.up * 0.75f, Vector3.down, ref val, 2.15f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return false; } ground = ((RaycastHit)(ref val)).point.y; normal = ((RaycastHit)(ref val)).normal; return true; } private void PlantFoot(ref Leg leg, float ground, float baseline, float drop, Vector3 normal) { //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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0124: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (leg.Valid) { float num = ground - baseline - drop; num = Mathf.Max(0f, num); num = Mathf.Min(num, LegLength(leg) * 0.5f); leg.Offset = Mathf.MoveTowards(leg.Offset, num, 14f * Time.deltaTime); if (leg.Offset > 0.0005f) { Vector3 target = leg.Foot.position + Vector3.up * (leg.Offset * Applied); SolveTwoBone(leg.Upper, leg.Knee, leg.Foot, target, ref leg.BendSign, ref leg.KneeSide); } float num2 = Mathf.Clamp01((Vector3.Angle(Vector3.up, normal) - 27.000002f) / 18f); Quaternion val = Quaternion.Slerp(LimitRoll(Quaternion.FromToRotation(Vector3.up, normal), leg.Foot), Quaternion.identity, num2); leg.Tilt = Quaternion.Slerp(leg.Tilt, val, Mathf.Clamp01(14f * Time.deltaTime)); leg.Foot.rotation = Quaternion.Slerp(Quaternion.identity, leg.Tilt, Applied) * leg.Foot.rotation; } } private static Quaternion LimitRoll(Quaternion tilt, Transform foot) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_008a: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) if (!Object.op_Implicit((Object)(object)foot)) { return tilt; } Vector3 val = Vector3.ProjectOnPlane(foot.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return tilt; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Project(new Vector3(tilt.x, tilt.y, tilt.z), val); Quaternion val3 = default(Quaternion); ((Quaternion)(ref val3))..ctor(val2.x, val2.y, val2.z, tilt.w); if (val3.x * val3.x + val3.y * val3.y + val3.z * val3.z + val3.w * val3.w < 1E-08f) { return tilt; } val3 = Quaternion.Normalize(val3); float num = default(float); Vector3 val4 = default(Vector3); ((Quaternion)(ref val3)).ToAngleAxis(ref num, ref val4); if (num > 180f) { num -= 360f; } if (Mathf.Abs(num) <= 14f) { return tilt; } Quaternion val5 = Quaternion.AngleAxis(Mathf.Clamp(num, -14f, 14f), val4); return tilt * Quaternion.Inverse(val3) * val5; } private static void SolveTwoBone(Transform upper, Transform knee, Transform foot, Vector3 target, ref float bendSign, ref Vector3 kneeSide) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_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_010b: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0178: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_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_0206: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0257: 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_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: 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_0301: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) Vector3 position = upper.position; float num = Vector3.Distance(position, knee.position); float num2 = Vector3.Distance(knee.position, foot.position); if (num <= 0.0001f || num2 <= 0.0001f) { return; } Vector3 val = target - position; float num3 = Mathf.Clamp(((Vector3)(ref val)).magnitude, 0.0001f, num + num2 - 0.0001f); if (!(((Vector3)(ref val)).sqrMagnitude < 1E-08f)) { Vector3 val2 = Vector3.Cross(knee.position - position, foot.position - knee.position); if (((Vector3)(ref val2)).sqrMagnitude < num * num2 * 0.01f) { val2 = upper.right; } ((Vector3)(ref val2)).Normalize(); upper.rotation = Quaternion.FromToRotation(foot.position - position, val) * upper.rotation; float num4 = Mathf.Acos(Mathf.Clamp((num * num + num3 * num3 - num2 * num2) / (2f * num * num3), -1f, 1f)) * 57.29578f; float num5 = Vector3.Angle(knee.position - position, foot.position - position); float num6 = num4 - num5; Quaternion rotation = upper.rotation; Vector3 position2 = knee.position; upper.rotation = Quaternion.AngleAxis(num6, val2) * rotation; float num7 = Vector3.SqrMagnitude(knee.position - position2); upper.rotation = Quaternion.AngleAxis(0f - num6, val2) * rotation; float num8 = Vector3.SqrMagnitude(knee.position - position2); bool flag = num7 < num8; float num9 = Mathf.Min(num7, num8); float num10 = Mathf.Max(num7, num8); if (flag != bendSign > 0f && num9 > num10 * 0.7f) { flag = bendSign > 0f; } Vector3 val3 = val / ((Vector3)(ref val)).magnitude; Vector3 val4 = Vector3.ProjectOnPlane(position2 - position, val3); if (((Vector3)(ref val4)).sqrMagnitude > num * num * 0.0004f) { ((Vector3)(ref val4)).Normalize(); kneeSide = val4; } else { val4 = Vector3.ProjectOnPlane(kneeSide, val3); val4 = ((((Vector3)(ref val4)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val4)).normalized : Vector3.zero); } bendSign = (flag ? 1f : (-1f)); if (flag) { upper.rotation = Quaternion.AngleAxis(num6, val2) * rotation; } if (((Vector3)(ref val4)).sqrMagnitude > 0.5f && Vector3.Dot(Vector3.ProjectOnPlane(knee.position - position, val3), val4) < 0f) { flag = !flag; bendSign = (flag ? 1f : (-1f)); upper.rotation = Quaternion.AngleAxis(flag ? num6 : (0f - num6), val2) * rotation; ReportInversion(upper); } knee.rotation = Quaternion.FromToRotation(foot.position - knee.position, target - knee.position) * knee.rotation; } } private void Resolve() { if (gaveUp || Time.time < nextSearchAt) { return; } nextSearchAt = Time.time + 0.5f; attempts++; Transform transform = ((Component)this).transform; if (!TrySearch(transform) && (Object)(object)((Component)this).transform.root != (Object)(object)((Component)this).transform) { TrySearch(((Component)this).transform.root); } if (!Object.op_Implicit((Object)(object)hips) || !left.Valid || !right.Valid) { if (attempts >= 30) { gaveUp = true; Plugin.Log.LogInfo((object)("Foot planting found no legs on " + ((Object)this).name + " after " + $"{attempts} tries; the rig keeps its animated feet.")); } } else { resolved = true; Plugin.Log.LogInfo((object)("Foot planting ready on " + ((Object)this).name + ".")); } } private bool TrySearch(Transform scope) { hips = FindBone(scope, 0); left.Upper = FindBone(scope, 1); left.Knee = FindBone(scope, 2); left.Foot = FindBone(scope, 3); right.Upper = FindBone(scope, 4); right.Knee = FindBone(scope, 5); right.Foot = FindBone(scope, 6); if (Object.op_Implicit((Object)(object)hips) && left.Valid) { return right.Valid; } return false; } private static Transform FindBone(Transform scope, int role) { Transform[] componentsInChildren = ((Component)scope).GetComponentsInChildren(true); string[] array = BoneNames[role]; foreach (string value in array) { Transform[] array2 = componentsInChildren; foreach (Transform val in array2) { if (((Object)val).name.EndsWith(value, StringComparison.Ordinal)) { return val; } } } return null; } } internal static class JujutsuFxLights { private const int Budget = 6; internal const float MinorRadiusThreshold = 3f; private static readonly List granted = new List(); internal static Light TryAdd(GameObject host, Color colour, float intensity, float range, bool major) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)host)) { return null; } Prune(); if (!major && granted.Count >= 6) { return null; } Light val = host.AddComponent(); val.type = (LightType)2; val.color = colour; val.intensity = intensity; val.range = Mathf.Max(1f, range); val.shadows = (LightShadows)0; val.renderMode = (LightRenderMode)(major ? 1 : 0); granted.Add(val); return val; } internal static Light TryAddMinor(GameObject host, Color colour, float intensity, float range, float effectRadius) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (effectRadius < 3f) { return null; } return TryAdd(host, colour, intensity, range, major: false); } private static void Prune() { for (int num = granted.Count - 1; num >= 0; num--) { Light val = granted[num]; if (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).enabled) { granted.RemoveAt(num); } } } } internal static class JujutsuFxMaterials { internal const float DefaultLineGlow = 1.5f; private static Material lineTemplate; private static Material surfaceTemplate; private static bool lineTemplateResolved; private static bool surfaceTemplateResolved; private static bool reported; private static readonly string[] VertexColourShaders = new string[6] { "Particles/Additive", "Legacy Shaders/Particles/Additive", "Particles/Alpha Blended", "Legacy Shaders/Particles/Alpha Blended", "Particles/Standard Unlit", "Sprites/Default" }; internal static bool VertexColoursSupported => Object.op_Implicit((Object)(object)LineTemplate); private static Material LineTemplate { get { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (lineTemplateResolved) { return lineTemplate; } lineTemplateResolved = true; try { Shader val = TakeLineRendererShader() ?? FindVertexColourShader(); if (Object.op_Implicit((Object)(object)val)) { lineTemplate = new Material(val) { name = "matJujutsuFxLine", hideFlags = (HideFlags)61 }; SetColour(lineTemplate, "_TintColor", Color.white); SetColour(lineTemplate, "_Color", Color.white); lineTemplate.renderQueue = 3000; } } catch (Exception arg) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Jujutsu effects could not find a vertex-coloured shader and will fall back to the lit one; " + $"per-element fades will not show: {arg}")); } } Report(); return lineTemplate; } } private static Material SurfaceTemplate { get { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown if (surfaceTemplateResolved) { return surfaceTemplate; } surfaceTemplateResolved = true; GameObject val = null; try { val = GameObject.CreatePrimitive((PrimitiveType)3); Renderer component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.sharedMaterial)) { surfaceTemplate = new Material(component.sharedMaterial) { name = "matJujutsuFxSurface", hideFlags = (HideFlags)61 }; } } catch (Exception arg) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Jujutsu effects could not take Unity's default " + $"material: {arg}")); } } finally { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } return surfaceTemplate; } } internal static Material CreateLineMaterial(string name, Color colour, float glow = 1.5f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0032: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) Material val = LineTemplate; if (!Object.op_Implicit((Object)(object)val)) { Material obj = CreateSurfaceMaterial(name, colour); ConfigureTransparent(obj); return obj; } Material val2 = new Material(val) { name = name }; SetTint(val2, colour, glow); return val2; } internal static Material CreateSurfaceMaterial(string name, Color colour) { //IL_0011: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002a: Expected O, but got Unknown Material val = SurfaceTemplate; if (!Object.op_Implicit((Object)(object)val)) { return null; } Material val2 = new Material(val) { name = name }; SetTint(val2, colour); return val2; } internal static void SetTint(Material material, Color colour, float glow = 1f) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)material)) { return; } if (IsUnlit(material)) { Color colour2 = default(Color); ((Color)(ref colour2))..ctor(colour.r * glow, colour.g * glow, colour.b * glow, colour.a); SetColour(material, "_Color", colour2); SetColour(material, "_TintColor", colour2); return; } SetColour(material, "_Color", colour); SetColour(material, "_BaseColor", colour); SetColour(material, "_MainColor", colour); SetColour(material, "_TintColor", colour); SetColour(material, "_EmissionColor", colour * (2.4f * glow)); if (material.HasProperty("_EmissionColor")) { material.EnableKeyword("_EMISSION"); } } internal static void SetEnvelope(Material material, Color baseColour, float alpha, float glow = 1.5f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Color colour = baseColour; colour.a *= Mathf.Clamp01(alpha); SetTint(material, colour, glow); } internal static void PrepareRenderer(Renderer renderer) { if (Object.op_Implicit((Object)(object)renderer)) { renderer.shadowCastingMode = (ShadowCastingMode)0; renderer.receiveShadows = false; renderer.lightProbeUsage = (LightProbeUsage)0; renderer.reflectionProbeUsage = (ReflectionProbeUsage)0; renderer.motionVectorGenerationMode = (MotionVectorGenerationMode)2; } } internal static void ConfigureTransparent(Material material) { if (Object.op_Implicit((Object)(object)material) && !IsUnlit(material)) { if (material.HasProperty("_Mode")) { material.SetFloat("_Mode", 3f); } if (material.HasProperty("_SrcBlend")) { material.SetInt("_SrcBlend", 5); } if (material.HasProperty("_DstBlend")) { material.SetInt("_DstBlend", 10); } if (material.HasProperty("_ZWrite")) { material.SetInt("_ZWrite", 0); } material.DisableKeyword("_ALPHATEST_ON"); material.EnableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.renderQueue = 3000; } } private static Shader TakeLineRendererShader() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown GameObject val = null; try { val = new GameObject("JujutsuFxLineTemplateProbe"); LineRenderer obj = val.AddComponent(); ((Renderer)obj).enabled = false; Material sharedMaterial = ((Renderer)obj).sharedMaterial; return Object.op_Implicit((Object)(object)sharedMaterial) ? sharedMaterial.shader : null; } finally { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } } private static Shader FindVertexColourShader() { Shader[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < VertexColourShaders.Length; i++) { for (int j = 0; j < array.Length; j++) { if (Object.op_Implicit((Object)(object)array[j]) && ((Object)array[j]).name == VertexColourShaders[i]) { return array[j]; } } } ReportCandidates(array); return null; } private static void ReportCandidates(Shader[] loaded) { StringBuilder stringBuilder = new StringBuilder(); int num = 0; for (int i = 0; i < loaded.Length; i++) { if (num >= 12) { break; } if (!Object.op_Implicit((Object)(object)loaded[i])) { continue; } string name = ((Object)loaded[i]).name; if (name.IndexOf("article", StringComparison.Ordinal) >= 0 || name.IndexOf("prite", StringComparison.Ordinal) >= 0 || name.IndexOf("nlit", StringComparison.Ordinal) >= 0) { if (num > 0) { stringBuilder.Append("; "); } stringBuilder.Append(name); num++; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)($"Jujutsu effects: none of the {VertexColourShaders.Length} " + $"expected shaders are loaded (of {loaded.Length} total). " + "Candidates present: " + ((num > 0) ? stringBuilder.ToString() : "none"))); } } internal static void Claim(GameObject owner, Material material) { if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)material)) { JujutsuFxMaterialOwner jujutsuFxMaterialOwner = owner.GetComponent(); if (!Object.op_Implicit((Object)(object)jujutsuFxMaterialOwner)) { jujutsuFxMaterialOwner = owner.AddComponent(); } jujutsuFxMaterialOwner.Claim(material); } } private static bool IsUnlit(Material material) { if (Object.op_Implicit((Object)(object)lineTemplate) && Object.op_Implicit((Object)(object)material)) { return (Object)(object)material.shader == (Object)(object)lineTemplate.shader; } return false; } private static void SetColour(Material material, string property, Color colour) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(property)) { material.SetColor(property, colour); } } private static void Report() { if (reported) { return; } reported = true; ManualLogSource log = Plugin.Log; if (log != null) { object obj; if (!Object.op_Implicit((Object)(object)lineTemplate)) { obj = "Jujutsu effects: no line material found, falling back to the lit shader; per-element fades will not show."; } else { Shader shader = lineTemplate.shader; obj = "Jujutsu effects: line shader '" + ((shader != null) ? ((Object)shader).name : null) + "', vertex colours live."; } log.LogInfo(obj); } } } internal sealed class JujutsuFxMaterialOwner : MonoBehaviour { private readonly List owned = new List(); internal void Claim(Material material) { if (Object.op_Implicit((Object)(object)material) && !owned.Contains(material)) { owned.Add(material); } } private void OnDestroy() { for (int i = 0; i < owned.Count; i++) { if (Object.op_Implicit((Object)(object)owned[i])) { Object.Destroy((Object)(object)owned[i]); } } owned.Clear(); } } internal static class JujutsuFxShake { private const float MinimumInterval = 0.09f; private static float lastShakeAt = -999f; private static bool failureLogged; internal static void Impact(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Play(position, 1.4f, 24f, 0.16f, 16f, important: false); } internal static void BlackFlash(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Play(position, 4.2f, 32f, 0.36f, 34f, important: true); } internal static void Detonation(Vector3 position, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Play(position, 3.4f, 20f, 0.42f, Mathf.Max(20f, radius * 1.4f), important: true); } internal static void Domain(Vector3 position, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Play(position, 2.6f, 9f, 1.1f, Mathf.Max(30f, radius), important: true); } private static void Play(Vector3 position, float amplitude, float frequency, float duration, float radius, bool important) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (failureLogged || (!important && Time.time - lastShakeAt < 0.09f)) { return; } try { ShakeEmitter.CreateSimpleShakeEmitter(position, new Wave { amplitude = amplitude, frequency = frequency, cycleOffset = 0f }, duration, radius, true); lastShakeAt = Time.time; } catch (Exception arg) { failureLogged = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Camera shake failed and has been switched off; " + $"gameplay is unaffected: {arg}")); } } } } internal sealed class JujutsuGroundField { private const float ProbeUp = 12f; private const float ProbeDown = 40f; private const float MinimumFloorNormal = 0.34f; private readonly Vector3 centre; private readonly float radius; private readonly int spokes; private readonly int rings; private readonly float[] heights; private readonly float[] coverage; private readonly Vector3[] normals; internal Vector3 Centre => centre; internal float Radius => radius; internal int Spokes => spokes; internal int Rings => rings; internal bool HasFloor { get; private set; } private JujutsuGroundField(Vector3 fieldCentre, float fieldRadius, int spokeCount, int ringCount) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) centre = fieldCentre; radius = Mathf.Max(0.5f, fieldRadius); spokes = Mathf.Max(3, spokeCount); rings = Mathf.Max(1, ringCount); int num = spokes * (rings + 1); heights = new float[num]; coverage = new float[num]; normals = (Vector3[])(object)new Vector3[num]; } internal static JujutsuGroundField Sample(Vector3 around, float fieldRadius, int spokeCount, int ringCount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) JujutsuGroundField jujutsuGroundField = new JujutsuGroundField(around, fieldRadius, spokeCount, ringCount); jujutsuGroundField.Measure(); return jujutsuGroundField; } private void Measure() { //IL_001a: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) float maximumStep = Mathf.Max(3f, radius * 0.9f); HasFloor = Probe(centre, maximumStep, out var height, out var normal); Vector3 val = default(Vector3); for (int i = 0; i < spokes; i++) { int num = Index(i, 0); heights[num] = (HasFloor ? height : 0f); normals[num] = (HasFloor ? normal : Vector3.up); coverage[num] = (HasFloor ? 1f : 0f); float num2 = (float)i / (float)spokes * MathF.PI * 2f; ((Vector3)(ref val))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); for (int j = 1; j <= rings; j++) { float num3 = radius * ((float)j / (float)rings); Vector3 at = centre + val * num3; int num4 = Index(i, j); if (Probe(at, maximumStep, out var height2, out var normal2)) { heights[num4] = height2; normals[num4] = normal2; coverage[num4] = 1f; } else { heights[num4] = 0f; normals[num4] = Vector3.up; coverage[num4] = 0f; } } } } private bool Probe(Vector3 at, float maximumStep, out float height, out Vector3 normal) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) height = 0f; normal = Vector3.up; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(at + Vector3.up * 12f, Vector3.down, ref val, 52f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return false; } if (((RaycastHit)(ref val)).normal.y < 0.34f) { return false; } float num = ((RaycastHit)(ref val)).point.y - centre.y; if (Mathf.Abs(num) > maximumStep) { return false; } height = num; normal = ((RaycastHit)(ref val)).normal; return true; } internal Vector3 Vertex(int spoke, int ring, float lift) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) int num = Index(spoke, ring); float num2 = (float)spoke / (float)spokes * MathF.PI * 2f; float num3 = radius * ((float)ring / (float)rings); return centre + new Vector3(Mathf.Cos(num2) * num3, heights[num], Mathf.Sin(num2) * num3) + normals[num] * lift; } internal float VertexCoverage(int spoke, int ring) { return coverage[Index(spoke, ring)]; } internal float Relief(int spoke, int ring) { float here = heights[Index(spoke, ring)]; return Mathf.Max(Mathf.Max(Mathf.Max(Mathf.Max(0f, Step(here, spoke, ring - 1)), Step(here, spoke, ring + 1)), Step(here, (spoke + 1) % spokes, ring)), Step(here, (spoke + spokes - 1) % spokes, ring)); } private float Step(float here, int spoke, int ring) { if (ring < 0 || ring > rings) { return 0f; } int num = Index(spoke, ring); if (coverage[num] < 0.5f) { return 0f; } return Mathf.Abs(heights[num] - here); } internal void HeightRange(out float lowest, out float highest) { lowest = float.MaxValue; highest = float.MinValue; for (int i = 0; i < heights.Length; i++) { if (!(coverage[i] < 0.5f)) { lowest = Mathf.Min(lowest, heights[i]); highest = Mathf.Max(highest, heights[i]); } } if (lowest > highest) { lowest = 0f; highest = 0f; } } internal Vector3 PointAt(float angle, float distance, float lift = 0f) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Resolve(angle, distance, out var height, out var _, out var normal); return centre + new Vector3(Mathf.Cos(angle) * distance, height, Mathf.Sin(angle) * distance) + normal * lift; } internal float CoverageAt(float angle, float distance) { Resolve(angle, distance, out var _, out var covered, out var _); return covered; } internal Vector3 GroundUnder(Vector3 worldPosition, float lift = 0f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = worldPosition - centre; Vector2 val2 = new Vector2(val.x, val.z); float magnitude = ((Vector2)(ref val2)).magnitude; float angle = Mathf.Atan2(val.z, val.x); Resolve(angle, magnitude, out var height, out var _, out var normal); return new Vector3(worldPosition.x, centre.y + height, worldPosition.z) + normal * lift; } private void Resolve(float angle, float distance, out float height, out float covered, out Vector3 normal) { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(distance / radius) * (float)rings; int num2 = Mathf.Clamp(Mathf.FloorToInt(num), 0, rings); int ring = Mathf.Min(num2 + 1, rings); float num3 = num - (float)num2; float num4 = Mathf.Repeat(angle / (MathF.PI * 2f), 1f) * (float)spokes; int num5 = Mathf.FloorToInt(num4) % spokes; int spoke = (num5 + 1) % spokes; float num6 = num4 - Mathf.Floor(num4); int num7 = Index(num5, num2); int num8 = Index(spoke, num2); int num9 = Index(num5, ring); int num10 = Index(spoke, ring); height = Mathf.Lerp(Mathf.Lerp(heights[num7], heights[num8], num6), Mathf.Lerp(heights[num9], heights[num10], num6), num3); covered = Mathf.Lerp(Mathf.Lerp(coverage[num7], coverage[num8], num6), Mathf.Lerp(coverage[num9], coverage[num10], num6), num3); normal = Vector3.Slerp(Vector3.Slerp(normals[num7], normals[num8], num6), Vector3.Slerp(normals[num9], normals[num10], num6), num3); } private int Index(int spoke, int ring) { return spoke * (rings + 1) + ring; } } internal sealed class JujutsuHeldBeam { private const float CoreFade = 0.14f; private const float BodyFade = 0.11f; private const float EdgeFade = 0.08f; private RuntimeSlashVisual core; private RuntimeSlashVisual body; private RuntimeSlashVisual edge; internal bool IsOpen { get { if (!Object.op_Implicit((Object)(object)core) && !Object.op_Implicit((Object)(object)body)) { return Object.op_Implicit((Object)(object)edge); } return true; } } internal void Open(Vector3 start, Vector3 end, float coreWidth, Color coreColour, float bodyWidth, Color bodyColour, float edgeWidth, Color edgeColour) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Close(); core = SukunaVisuals.CreateHeldSlash(start, end, coreWidth, 0.14f, coreColour); body = SukunaVisuals.CreateHeldSlash(start, end, bodyWidth, 0.11f, bodyColour); edge = SukunaVisuals.CreateHeldSlash(start, end, edgeWidth, 0.08f, edgeColour); } internal void Aim(Vector3 start, Vector3 end, float snap) { //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_0039: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)core)) { core.SetEnds(start, end); core.SetWidthScale(snap); } if (Object.op_Implicit((Object)(object)body)) { body.SetEnds(start, end); body.SetWidthScale(snap); } if (Object.op_Implicit((Object)(object)edge)) { edge.SetEnds(start, end); } } internal void Close() { Release(ref core); Release(ref body); Release(ref edge); } private static void Release(ref RuntimeSlashVisual slash) { if (Object.op_Implicit((Object)(object)slash)) { slash.Release(); } slash = null; } } internal sealed class JujutsuNeckFit : MonoBehaviour { private const string HeadBone = "mixamorig:Head"; private const float Ignore = 0.002f; private const float MostThatMayGo = 0.6f; private static float[] excessBySkin; private Transform head; private Vector3 shipped; private bool captured; private int lastApplied = -1; private void Awake() { Capture(); } private void Capture() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!captured) { head = FindDeep(((Component)this).transform, "mixamorig:Head"); if (!Object.op_Implicit((Object)(object)head)) { Plugin.Log.LogWarning((object)("Neck fit: no mixamorig:Head under " + ((Object)this).name + ", so no outfit will have its neck adjusted. The rig may have been imported under other bone names.")); return; } shipped = head.localPosition; captured = true; } } internal static void NoteOutfitHeights(float[] tops) { if (tops == null || tops.Length == 0) { return; } List list = new List(); foreach (float num in tops) { if (num > float.MinValue) { list.Add(num); } } if (list.Count == 0) { return; } list.Sort(); float num2 = list[list.Count / 2]; excessBySkin = new float[tops.Length + 1]; StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < tops.Length; j++) { if (!(tops[j] <= float.MinValue)) { float num3 = tops[j] - num2; excessBySkin[j + 1] = ((num3 > 0.002f) ? num3 : 0f); stringBuilder.Append($" skin{j + 1}={tops[j]:0.000}"); if (excessBySkin[j + 1] > 0f) { stringBuilder.Append($"(-{num3:0.000})"); } } } Plugin.Log.LogInfo((object)($"Neck fit: outfits stand at{stringBuilder}, set at " + $"{num2:0.000}. Anything above it has the difference " + "taken out of its neck; the rig is not scaled.")); } internal void ApplyForSkin(int skinIndex) { //IL_0080: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) Capture(); if (captured && Object.op_Implicit((Object)(object)head)) { float num = Excess(skinIndex); float num2 = 0f; if (num > 0f) { num2 = Mathf.Min(BoneLengthFor(num), ((Vector3)(ref shipped)).magnitude * 0.6f); head.localPosition = ((Vector3)(ref shipped)).normalized * (((Vector3)(ref shipped)).magnitude - num2); } else { head.localPosition = shipped; } if (skinIndex != lastApplied) { lastApplied = skinIndex; ManualLogSource log = Plugin.Log; string[] obj = new string[7] { $"Neck fit: skin {skinIndex} on {((Object)this).name} -> ", null, null, null, null, null, null }; Vector3 localPosition = head.localPosition; obj[1] = $"{((Vector3)(ref localPosition)).magnitude:0.####} of "; obj[2] = $"{((Vector3)(ref shipped)).magnitude:0.####} "; obj[3] = "("; obj[4] = ((num > 0f) ? $"{num:0.000} m of height taken out of the neck" : "nothing to take"); obj[5] = ")"; obj[6] = $" at frame {Time.frameCount}."; log.LogInfo((object)string.Concat(obj)); } } } private static float Excess(int skinIndex) { return ((excessBySkin != null && skinIndex >= 0 && skinIndex < excessBySkin.Length) ? excessBySkin[skinIndex] : 0f) * Strength(); } private static float Strength() { if (JujutsuConfig.YujiNeckCorrection == null) { return 1f; } return Mathf.Clamp(JujutsuConfig.YujiNeckCorrection.Value, 0f, 2f); } private float BoneLengthFor(float heightInModel) { //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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Transform parent = head.parent; if (!Object.op_Implicit((Object)(object)parent) || ((Vector3)(ref shipped)).magnitude < 0.0001f) { return 0f; } Vector3 val = ((Component)this).transform.InverseTransformPoint(head.position) - ((Component)this).transform.InverseTransformPoint(parent.position); float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.0001f) { return 0f; } float num = magnitude / ((Vector3)(ref shipped)).magnitude; float num2 = Mathf.Max(val.y / magnitude, 0.5f); return heightInModel / (num * num2); } private static Transform FindDeep(Transform parent, string name) { if (((Object)parent).name == name) { return parent; } for (int i = 0; i < parent.childCount; i++) { Transform val = FindDeep(parent.GetChild(i), name); if (Object.op_Implicit((Object)(object)val)) { return val; } } return null; } internal static void NotifySkinApplied(GameObject root, int skinIndex) { if (Object.op_Implicit((Object)(object)root)) { JujutsuNeckFit componentInChildren = root.GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.ApplyForSkin(skinIndex); } } } } internal static class JujutsuPrimitives { private static Mesh sphereMesh; private static Mesh cubeMesh; private static Mesh cylinderMesh; private static Material sourceMaterial; private static bool reported; private static void EnsureCached(PrimitiveType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003a: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)Cached(type))) { return; } GameObject val = GameObject.CreatePrimitive(type); MeshFilter component = val.GetComponent(); Renderer component2 = val.GetComponent(); Mesh val2 = (Object.op_Implicit((Object)(object)component) ? component.sharedMesh : null); if ((int)type != 0) { if ((int)type == 3) { cubeMesh = val2; } else { cylinderMesh = val2; } } else { sphereMesh = val2; } if (!Object.op_Implicit((Object)(object)sourceMaterial) && Object.op_Implicit((Object)(object)component2)) { sourceMaterial = component2.sharedMaterial; } Object.Destroy((Object)(object)val); if (!reported) { reported = true; Plugin.Log.LogInfo((object)"Effect primitives cached: mesh and shader taken from one throwaway primitive. Every effect after this is a mesh filter and a renderer, with no collider built and destroyed on the way."); } } private static Mesh Cached(PrimitiveType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 if ((int)type != 0) { if ((int)type == 3) { return cubeMesh; } return cylinderMesh; } return sphereMesh; } internal static GameObject Sphere(string name, Vector3 position, bool ownMaterial = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Build((PrimitiveType)0, name, position, ownMaterial); } internal static GameObject Cube(string name, Vector3 position, bool ownMaterial = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Build((PrimitiveType)3, name, position, ownMaterial); } internal static GameObject Cylinder(string name, Vector3 position, bool ownMaterial = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Build((PrimitiveType)2, name, position, ownMaterial); } private static GameObject Build(PrimitiveType type, string name, Vector3 position, bool ownMaterial) { //IL_0000: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown EnsureCached(type); Mesh sharedMesh = Cached(type); GameObject val = new GameObject(name); val.transform.position = position; val.AddComponent().sharedMesh = sharedMesh; MeshRenderer val2 = val.AddComponent(); if (ownMaterial && Object.op_Implicit((Object)(object)sourceMaterial)) { ((Renderer)val2).material = new Material(sourceMaterial); } ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; return val; } } [DefaultExecutionOrder(520)] internal sealed class JujutsuSleevePhysics : MonoBehaviour { private sealed class Sleeve { public Transform Pivot; public Transform Spring; public float Swing; public float Peak; public Vector3 RestLocalDirection; public Vector3 Direction; public Vector3 Velocity; public Vector3 LastPivotPosition; public bool Started; } private const float FreeIgnored = 0.075f; private const float FreeFull = 0.155f; private const float MaxSpringShare = 0.85f; private const float ArmShareNeeded = 0.5f; private const float Stiffness = 26f; private const float Damping = 6.5f; private const float GravityPull = 0.5f; private const float DragSeconds = 0.09f; private const float MaxSwingDegrees = 45f; private const float TeleportDistance = 2.5f; private const float MaxStep = 0.05f; private const int TraceReports = 5; private const float TraceInterval = 3f; private Sleeve[] sleeves; private int tracesLeft = 5; private float nextTrace; internal static int Attach(SkinnedMeshRenderer renderer, Transform[] skeleton) { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_01c7: 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_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: 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_030e: 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_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033d: 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_0346: 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_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: 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_0391: 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_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)renderer) || (Object)(object)renderer.sharedMesh == (Object)null) { return 0; } Mesh sharedMesh = renderer.sharedMesh; Vector3[] vertices = sharedMesh.vertices; BoneWeight[] boneWeights = sharedMesh.boneWeights; Transform[] bones = renderer.bones; Matrix4x4[] bindposes = sharedMesh.bindposes; if (vertices.Length == 0 || boneWeights.Length != vertices.Length || bones.Length != bindposes.Length) { return 0; } Transform transform = ((Component)renderer).transform; List list = new List(2); List list2 = new List(2); List list3 = new List(2); float[] array = new float[vertices.Length]; int[] array2 = new int[vertices.Length]; for (int i = 0; i < array2.Length; i++) { array2[i] = -1; } string[] array3 = new string[2] { "Left", "Right" }; foreach (string text in array3) { Transform val = Find(skeleton, "mixamorig:" + text + "Arm"); Transform val2 = Find(skeleton, "mixamorig:" + text + "Hand"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { continue; } Transform wanted = Find(skeleton, "mixamorig:" + text + "ForeArm"); int num = IndexOf(bones, val); int num2 = IndexOf(bones, wanted); int num3 = IndexOf(bones, val2); if (num < 0 && num2 < 0 && num3 < 0) { continue; } Vector3 val3 = transform.InverseTransformPoint(val.position); Vector3 val4 = transform.InverseTransformPoint(val2.position) - val3; float magnitude = ((Vector3)(ref val4)).magnitude; if (magnitude < 0.0001f) { continue; } val4 /= magnitude; int num4 = bones.Length + list2.Count; Vector3 val5 = Vector3.zero; float num5 = 0f; Vector3 val7; for (int k = 0; k < vertices.Length; k++) { if (WeightOn(boneWeights[k], num, num2, num3) < 0.5f) { continue; } Vector3 val6 = vertices[k] - val3; float num6 = Mathf.Clamp(Vector3.Dot(val6, val4), 0f, magnitude); val7 = val6 - num6 * val4; float magnitude2 = ((Vector3)(ref val7)).magnitude; if (!(magnitude2 <= 0.075f) && array2[k] < 0) { float num7 = Mathf.InverseLerp(0.075f, 0.155f, magnitude2); num7 = num7 * num7 * (3f - 2f * num7); float num8 = num7 * 0.85f; if (!(num8 <= 0.01f)) { array2[k] = num4; array[k] = num8; val5 += vertices[k] * num8; num5 += num8; } } } if (!(num5 <= 0f)) { val5 /= num5; Transform transform2 = new GameObject("SukunaSleeve" + text) { layer = ((Component)val).gameObject.layer }.transform; transform2.SetParent(val, false); transform2.localPosition = Vector3.zero; transform2.localRotation = Quaternion.identity; transform2.localScale = Vector3.one; list2.Add(transform2); list3.Add(transform2.worldToLocalMatrix * transform.localToWorldMatrix); Vector3 val8 = transform.TransformPoint(val5) - val.position; if (((Vector3)(ref val8)).sqrMagnitude < 1E-06f) { val8 = Vector3.down; } Sleeve obj = new Sleeve { Pivot = val, Spring = transform2 }; val7 = val.InverseTransformDirection(val8); obj.RestLocalDirection = ((Vector3)(ref val7)).normalized; list.Add(obj); } } if (list.Count == 0) { return 0; } Transform[] array4 = (Transform[])(object)new Transform[bones.Length + list2.Count]; bones.CopyTo(array4, 0); Matrix4x4[] array5 = (Matrix4x4[])(object)new Matrix4x4[bindposes.Length + list3.Count]; bindposes.CopyTo(array5, 0); for (int l = 0; l < list2.Count; l++) { array4[bones.Length + l] = list2[l]; array5[bindposes.Length + l] = list3[l]; } int num9 = 0; for (int m = 0; m < vertices.Length; m++) { if (array2[m] >= 0) { boneWeights[m] = Blend(boneWeights[m], array2[m], array[m]); num9++; } } sharedMesh.bindposes = array5; sharedMesh.boneWeights = boneWeights; renderer.bones = array4; ((Component)renderer).gameObject.AddComponent().sleeves = list.ToArray(); Plugin.Log.LogInfo((object)($"Haori sleeves: {list.Count} spring bone(s) on " + $"{((Object)renderer).name}, {num9} of {vertices.Length} vertices " + "partly on them.")); return list.Count; } private static BoneWeight Blend(BoneWeight source, int extraBone, float amount) { //IL_010b: 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_0107: Unknown result type (might be due to invalid IL or missing references) float num = 1f - amount; int[] array = new int[5] { ((BoneWeight)(ref source)).boneIndex0, ((BoneWeight)(ref source)).boneIndex1, ((BoneWeight)(ref source)).boneIndex2, ((BoneWeight)(ref source)).boneIndex3, extraBone }; float[] array2 = new float[5] { ((BoneWeight)(ref source)).weight0 * num, ((BoneWeight)(ref source)).weight1 * num, ((BoneWeight)(ref source)).weight2 * num, ((BoneWeight)(ref source)).weight3 * num, amount }; for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 5; j++) { if (array2[j] > array2[i]) { ref float reference = ref array2[i]; ref float reference2 = ref array2[j]; float num2 = array2[j]; float num3 = array2[i]; reference = num2; reference2 = num3; ref int reference3 = ref array[i]; ref int reference4 = ref array[j]; int num4 = array[j]; int num5 = array[i]; reference3 = num4; reference4 = num5; } } } float num6 = array2[0] + array2[1] + array2[2] + array2[3]; if (num6 <= 0f) { return source; } BoneWeight result = default(BoneWeight); ((BoneWeight)(ref result)).boneIndex0 = array[0]; ((BoneWeight)(ref result)).boneIndex1 = array[1]; ((BoneWeight)(ref result)).boneIndex2 = array[2]; ((BoneWeight)(ref result)).boneIndex3 = array[3]; ((BoneWeight)(ref result)).weight0 = array2[0] / num6; ((BoneWeight)(ref result)).weight1 = array2[1] / num6; ((BoneWeight)(ref result)).weight2 = array2[2] / num6; ((BoneWeight)(ref result)).weight3 = array2[3] / num6; return result; } private static float WeightOn(BoneWeight weight, int first, int second, int third) { float num = 0f; for (int i = 0; i < 4; i++) { int num2; float num3; switch (i) { case 0: num2 = ((BoneWeight)(ref weight)).boneIndex0; num3 = ((BoneWeight)(ref weight)).weight0; break; case 1: num2 = ((BoneWeight)(ref weight)).boneIndex1; num3 = ((BoneWeight)(ref weight)).weight1; break; case 2: num2 = ((BoneWeight)(ref weight)).boneIndex2; num3 = ((BoneWeight)(ref weight)).weight2; break; default: num2 = ((BoneWeight)(ref weight)).boneIndex3; num3 = ((BoneWeight)(ref weight)).weight3; break; } if (num2 >= 0 && (num2 == first || num2 == second || num2 == third)) { num += num3; } } return num; } private static int IndexOf(Transform[] bones, Transform wanted) { if (!Object.op_Implicit((Object)(object)wanted)) { return -1; } for (int i = 0; i < bones.Length; i++) { if ((Object)(object)bones[i] == (Object)(object)wanted) { return i; } } return -1; } private static Transform Find(Transform[] skeleton, string name) { foreach (Transform val in skeleton) { if (Object.op_Implicit((Object)(object)val) && string.Equals(((Object)val).name, name, StringComparison.Ordinal)) { return val; } } return null; } private void OnEnable() { if (sleeves != null) { Sleeve[] array = sleeves; foreach (Sleeve obj in array) { obj.Started = false; obj.Peak = 0f; } nextTrace = Time.time + 3f; } } private void LateUpdate() { if (sleeves == null) { return; } float num = Mathf.Min(Time.deltaTime, 0.05f); if (num <= 0f) { return; } Sleeve[] array = sleeves; foreach (Sleeve sleeve in array) { if (Object.op_Implicit((Object)(object)sleeve.Pivot) && Object.op_Implicit((Object)(object)sleeve.Spring)) { Step(sleeve, num); } } if (tracesLeft > 0 && Time.time >= nextTrace) { tracesLeft--; nextTrace = Time.time + 3f; string text = string.Empty; array = sleeves; foreach (Sleeve sleeve2 in array) { text = text + " " + ((Object)sleeve2.Pivot).name.Replace("mixamorig:", string.Empty) + $"={sleeve2.Swing:0.0}° peak {sleeve2.Peak:0.0}°"; sleeve2.Peak = 0f; } ManualLogSource log = Plugin.Log; string[] obj = new string[5] { "Haori sleeve swing on ", null, null, null, null }; Transform parent = ((Component)this).transform.parent; obj[1] = ((parent != null) ? ((Object)parent).name : null) ?? ((Object)this).name; obj[2] = ":"; obj[3] = text; obj[4] = $" (limit {45f:0}°)"; log.LogInfo((object)string.Concat(obj)); } } private static void Step(Sleeve sleeve, float step) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00d4: 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_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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_011a: 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_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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_0140: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_0186: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) Transform pivot = sleeve.Pivot; Vector3 val = pivot.TransformDirection(sleeve.RestLocalDirection); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 position = pivot.position; if (sleeve.Started) { val = position - sleeve.LastPivotPosition; if (!(((Vector3)(ref val)).sqrMagnitude > 6.25f)) { Vector3 val2 = (position - sleeve.LastPivotPosition) / step; sleeve.LastPivotPosition = position; Vector3 val3 = Vector3.Slerp(normalized, Vector3.down, 0.5f); val3 -= val2 * 0.09f; if (((Vector3)(ref val3)).sqrMagnitude < 1E-06f) { val3 = normalized; } ((Vector3)(ref val3)).Normalize(); sleeve.Velocity += (val3 - sleeve.Direction) * (26f * step); sleeve.Velocity *= Mathf.Exp(-6.5f * step); Vector3 val4 = sleeve.Direction + sleeve.Velocity * step; if (((Vector3)(ref val4)).sqrMagnitude < 1E-06f) { val4 = normalized; } ((Vector3)(ref val4)).Normalize(); float num = Vector3.Angle(normalized, val4); sleeve.Swing = Mathf.Min(num, 45f); sleeve.Peak = Mathf.Max(sleeve.Peak, sleeve.Swing); if (num > 45f) { val4 = Vector3.RotateTowards(normalized, val4, MathF.PI / 4f, 0f); sleeve.Velocity = Vector3.ProjectOnPlane(sleeve.Velocity, val4); } sleeve.Direction = val4; sleeve.Spring.rotation = Quaternion.FromToRotation(normalized, val4) * pivot.rotation; return; } } sleeve.Direction = normalized; sleeve.Velocity = Vector3.zero; sleeve.LastPivotPosition = position; sleeve.Started = true; sleeve.Spring.rotation = pivot.rotation; } } internal static class JujutsuTextures { private struct Waiting { internal Texture2D Texture; internal string Path; } private static float savedMegabytes; private static long decodeMilliseconds; private static long compressMilliseconds; private static int done; private static readonly Queue pending = new Queue(); internal static Texture2D Load(string path, string name, TextureWrapMode wrapMode, bool sharpenAtAngles = false) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ((Object)val).name = name; ((Texture)val).wrapMode = wrapMode; if (sharpenAtAngles) { ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).anisoLevel = 4; } val.SetPixels32((Color32[])(object)new Color32[4] { new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) }); val.Apply(); pending.Enqueue(new Waiting { Texture = val, Path = path }); return val; } internal static void EnsureLoaded(Texture2D texture) { if (!Object.op_Implicit((Object)(object)texture) || pending.Count == 0) { return; } for (int num = pending.Count; num > 0; num--) { Waiting waiting = pending.Dequeue(); if ((Object)(object)waiting.Texture == (Object)(object)texture) { Fill(waiting); } else { pending.Enqueue(waiting); } } } internal static IEnumerator ProcessPending() { Stopwatch frame = new Stopwatch(); while (true) { if (pending.Count == 0) { yield return null; continue; } frame.Restart(); while (pending.Count > 0 && frame.ElapsedMilliseconds < 4) { Fill(pending.Dequeue()); } yield return null; } } private static void Fill(Waiting waiting) { if (Object.op_Implicit((Object)(object)waiting.Texture)) { Stopwatch stopwatch = Stopwatch.StartNew(); byte[] array; try { array = File.ReadAllBytes(waiting.Path); } catch (IOException ex) { Plugin.Log.LogWarning((object)("Texture " + ((Object)waiting.Texture).name + " could not be read and stays white: " + ex.Message)); return; } if (!ImageConversion.LoadImage(waiting.Texture, array, false)) { Plugin.Log.LogWarning((object)("Texture " + ((Object)waiting.Texture).name + " is not a picture and stays white.")); return; } decodeMilliseconds += stopwatch.ElapsedMilliseconds; Compact(waiting.Texture); } } private static void Compact(Texture2D texture) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) TextureFormat format = texture.format; float num = Megabytes(texture, format); Stopwatch stopwatch = Stopwatch.StartNew(); if ((JujutsuConfig.CompressTextures == null || JujutsuConfig.CompressTextures.Value) && ((Texture)texture).width % 4 == 0 && ((Texture)texture).height % 4 == 0) { texture.Compress(false); } float num2 = Megabytes(texture, texture.format); texture.Apply(false, true); savedMegabytes += num - num2; compressMilliseconds += stopwatch.ElapsedMilliseconds; done++; Plugin.Log.LogInfo((object)($"Texture {((Object)texture).name}: {((Texture)texture).width}x{((Texture)texture).height} " + $"{format} -> {texture.format}, " + $"{num:F1} MB -> {num2:F1} MB in video " + $"memory in {stopwatch.ElapsedMilliseconds} ms " + $"({savedMegabytes:F0} MB saved so far, plus the same again " + "in system memory).")); if (pending.Count == 0) { Plugin.Log.LogInfo((object)($"Textures so far: {done} of them, {(float)decodeMilliseconds / 1000f:F2} s " + $"decoding and {(float)compressMilliseconds / 1000f:F2} s " + "compressing, all of it spread across frames rather than " + $"spent before the game starts, saving {savedMegabytes:F0} MB " + "of video memory.")); } } private static float Megabytes(Texture2D texture, TextureFormat format) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) float num = ((Texture)texture).width * ((Texture)texture).height; if (((Texture)texture).mipmapCount > 1) { num *= 1.3333334f; } return num * (float)BitsPerPixel(format) / 8f / 1048576f; } private static int BitsPerPixel(TextureFormat format) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected I4, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)format <= 10) { if ((int)format == 3) { return 24; } if ((int)format != 10) { goto IL_003b; } } else { if ((int)format == 12) { goto IL_0036; } switch (format - 25) { case 3: break; case 0: case 4: goto IL_0036; default: goto IL_003b; } } return 4; IL_0036: return 8; IL_003b: return 32; } } internal sealed class MixamoCharacterModel { private sealed class ModelData { internal string[] BoneNames; internal int[] ParentIndices; internal Vector3[] BonePositions; internal Quaternion[] BoneRotations; internal Vector3[] BoneScales; internal MeshData[] Meshes; } private sealed class MeshData { internal string Name; internal int OutfitIndex; internal string MaterialName; internal string TextureName; internal bool IsDecal; internal Vector3[] Vertices; internal Vector3[] Normals; internal Vector2[] Uvs; internal BoneWeight[] BoneWeights; internal int[] Triangles; } private readonly string modelFileName; private readonly string textureDirectoryName; private readonly string label; private readonly float scale; private readonly string animationFileName; private ModelData cachedModel; private readonly Dictionary textureCache = new Dictionary(StringComparer.Ordinal); private Material cachedTemplateMaterial; internal MixamoCharacterModel(string label, string modelFileName, string textureDirectoryName, float scale, string animationFileName) { this.label = label; this.modelFileName = modelFileName; this.textureDirectoryName = textureDirectoryName; this.scale = scale; this.animationFileName = animationFileName; } internal bool Apply(GameObject prefab) { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_018b: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_024b: 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) GameObject val = null; try { CharacterModel componentInChildren = prefab.GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)componentInChildren)) { Plugin.Log.LogWarning((object)("CharacterModel was not found while applying the " + label + " model to " + ((Object)prefab).name + ".")); return false; } ModelData modelData = LoadModel(); if (modelData == null) { Plugin.Log.LogError((object)(label + " model data could not be loaded for " + ((Object)prefab).name + "; the vanilla model stays visible.")); return false; } Material val2 = FindTemplateMaterial(componentInChildren); if (!Object.op_Implicit((Object)(object)val2)) { Plugin.Log.LogError((object)("No safe material template was available for " + ((Object)prefab).name + "; the vanilla model stays visible.")); return false; } Plugin.Log.LogInfo((object)("Loaded " + label + " runtime data for " + ((Object)prefab).name + ": " + $"{modelData.BoneNames.Length} bones, " + $"{modelData.Meshes.Length} mesh parts.")); Renderer[] componentsInChildren = ((Component)componentInChildren).GetComponentsInChildren(true); Light[] componentsInChildren2 = ((Component)componentInChildren).GetComponentsInChildren(true); val = new GameObject(label + "ImportedModel"); val.layer = ((Component)componentInChildren).gameObject.layer; Transform transform = val.transform; transform.SetParent(((Component)componentInChildren).transform, false); transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.Euler(-90f, 0f, 0f); transform.localScale = Vector3.one * scale; Transform[] array = BuildSkeleton(modelData, transform); List list = BuildMeshes(modelData, array, transform, val2, ((Component)componentInChildren).gameObject.layer); StandOnTheGround(componentInChildren, transform, modelData, array); if (list.Count == 0) { Object.DestroyImmediate((Object)(object)val); Plugin.Log.LogError((object)(label + " model contained no usable renderers for " + ((Object)prefab).name + ".")); return false; } RendererInfo[] baseRendererInfos = componentInChildren.baseRendererInfos; foreach (RendererInfo val3 in baseRendererInfos) { if (Object.op_Implicit((Object)(object)val3.renderer)) { val3.renderer.enabled = false; } } RendererInfo[] array2 = (componentInChildren.baseRendererInfos = list.ToArray()); componentInChildren.mainSkinnedMeshRenderer = FindMainRenderer(array2); componentInChildren.materialsDirty = true; componentInChildren.forceUpdate = true; Renderer[] array3 = (Renderer[])(object)new Renderer[array2.Length]; for (int j = 0; j < array2.Length; j++) { array3[j] = array2[j].renderer; } val.AddComponent().Configure(componentsInChildren, array3, componentsInChildren2); SukunaMixamoAnimationDriver sukunaMixamoAnimationDriver = val.AddComponent(); sukunaMixamoAnimationDriver.UseAnimationFile(animationFileName); sukunaMixamoAnimationDriver.Configure(modelData.BoneNames, array); val.AddComponent().Configure(componentInChildren, modelData.BoneNames, array); val.AddComponent(); Plugin.Log.LogInfo((object)("Applied the " + label + " rig to " + ((Object)prefab).name + ": " + $"{modelData.BoneNames.Length} bones, " + $"{array2.Length} skinned renderers.")); return true; } catch (Exception ex) { if (Object.op_Implicit((Object)(object)val)) { Object.DestroyImmediate((Object)(object)val); } Plugin.Log.LogError((object)("Applying the " + label + " model to " + ((Object)prefab).name + " failed: " + ex)); return false; } } private static Transform FindVanillaSole(CharacterModel characterModel) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Transform val = null; Transform[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { string text = ((Object)componentsInChildren[i]).name.ToLowerInvariant(); if ((text.Contains("foot") || text.Contains("toe") || text.Contains("ankle")) && (!Object.op_Implicit((Object)(object)val) || componentsInChildren[i].position.y < val.position.y)) { val = componentsInChildren[i]; } } return val; } private void StandOnTheGround(CharacterModel characterModel, Transform container, ModelData modelData, Transform[] skeletonForGrounding) { //IL_00ae: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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) Transform transform = ((Component)characterModel).transform; Transform val = FindVanillaSole(characterModel); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)(label + " could not be grounded: no foot bone found on the vanilla rig. Leaving it where the container puts it.")); return; } float num = float.MaxValue; float num2 = float.MinValue; for (int i = 0; i < modelData.Meshes.Length; i++) { Vector3[] vertices = modelData.Meshes[i].Vertices; for (int j = 0; j < vertices.Length; j++) { float y = transform.InverseTransformPoint(container.TransformPoint(vertices[j])).y; if (y < num) { num = y; } if (y > num2) { num2 = y; } } } if (num != float.MaxValue) { float y2 = transform.InverseTransformPoint(val.position).y; float num3 = y2 - num; if (Mathf.Abs(num3) > 0.35f) { Plugin.Log.LogWarning((object)($"{label} grounding wanted to move {num3:+0.000;-0.000}, " + "which is too far to be right (sole bone " + $"'{((Object)val).name}' at {y2:0.000}, mesh bottom at " + $"{num:0.000}). Left where it was.")); return; } container.localPosition += new Vector3(0f, num3, 0f); Plugin.Log.LogInfo((object)($"{label} grounded: mesh bottom at {num:0.000}, " + $"vanilla sole bone '{((Object)val).name}' at {y2:0.000}, " + $"moved {num3:+0.000;-0.000}; draws " + $"{num2 - num:0.000} tall at scale " + $"{scale:0.00}.")); } } private ModelData LoadModel() { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: 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_0306: 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_0376: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) if (cachedModel != null) { return cachedModel; } string text = JujutsuAssetPaths.Find("assets", modelFileName); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)(label + " model data was not found: " + text)); return null; } using FileStream input = File.OpenRead(text); using BinaryReader binaryReader = new BinaryReader(input); byte[] array = new byte[8] { 83, 85, 75, 78, 77, 68, 76, 49 }; byte[] array2 = binaryReader.ReadBytes(array.Length); if (array2.Length != array.Length) { throw new InvalidDataException(label + " model header is incomplete."); } for (int i = 0; i < array.Length; i++) { if (array2[i] != array[i]) { throw new InvalidDataException(label + " model header is invalid."); } } int num = binaryReader.ReadInt32(); if (num != 2) { throw new InvalidDataException($"Unsupported {label} model version {num}."); } int num2 = ReadSafeCount(binaryReader, 1, 1024, "bone"); ModelData modelData = new ModelData { BoneNames = new string[num2], ParentIndices = new int[num2], BonePositions = (Vector3[])(object)new Vector3[num2], BoneRotations = (Quaternion[])(object)new Quaternion[num2], BoneScales = (Vector3[])(object)new Vector3[num2] }; for (int j = 0; j < num2; j++) { modelData.BoneNames[j] = binaryReader.ReadString(); modelData.ParentIndices[j] = binaryReader.ReadInt32(); modelData.BonePositions[j] = ReadVector3(binaryReader); modelData.BoneRotations[j] = ReadQuaternion(binaryReader); modelData.BoneScales[j] = ReadVector3(binaryReader); if (modelData.ParentIndices[j] >= j || modelData.ParentIndices[j] < -1) { throw new InvalidDataException($"{label} bone {j} has an invalid parent."); } } int num3 = ReadSafeCount(binaryReader, 1, 128, "mesh"); modelData.Meshes = new MeshData[num3]; for (int k = 0; k < num3; k++) { MeshData meshData = new MeshData { Name = binaryReader.ReadString(), OutfitIndex = binaryReader.ReadInt32(), MaterialName = binaryReader.ReadString(), TextureName = binaryReader.ReadString(), IsDecal = binaryReader.ReadBoolean() }; int num4 = ReadSafeCount(binaryReader, 3, 100000, "vertex"); meshData.Vertices = (Vector3[])(object)new Vector3[num4]; meshData.Normals = (Vector3[])(object)new Vector3[num4]; meshData.Uvs = (Vector2[])(object)new Vector2[num4]; meshData.BoneWeights = (BoneWeight[])(object)new BoneWeight[num4]; for (int l = 0; l < num4; l++) { meshData.Vertices[l] = ReadVector3(binaryReader); meshData.Normals[l] = ReadVector3(binaryReader); meshData.Uvs[l] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); BoneWeight val = default(BoneWeight); ((BoneWeight)(ref val)).boneIndex0 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex1 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex2 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex3 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).weight0 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight1 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight2 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight3 = binaryReader.ReadSingle(); BoneWeight val2 = val; if (((BoneWeight)(ref val2)).boneIndex0 < 0 || ((BoneWeight)(ref val2)).boneIndex0 >= num2) { throw new InvalidDataException($"{label} mesh {meshData.Name} vertex {l} " + "references a bone that does not exist."); } meshData.BoneWeights[l] = val2; } int num5 = ReadSafeCount(binaryReader, 3, 400000, "index"); meshData.Triangles = new int[num5]; for (int m = 0; m < num5; m++) { int num6 = binaryReader.ReadInt32(); if (num6 < 0 || num6 >= num4) { throw new InvalidDataException(label + " mesh " + meshData.Name + " has an index out of range."); } meshData.Triangles[m] = num6; } modelData.Meshes[k] = meshData; } cachedModel = modelData; return modelData; } private static int ReadSafeCount(BinaryReader reader, int minimum, int maximum, string what) { int num = reader.ReadInt32(); if (num < minimum || num > maximum) { throw new InvalidDataException($"Implausible {what} count {num}."); } return num; } private static Vector3 ReadVector3(BinaryReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } private static Quaternion ReadQuaternion(BinaryReader reader) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } private Transform[] BuildSkeleton(ModelData modelData, Transform container) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_007c: Unknown result type (might be due to invalid IL or missing references) Transform[] array = (Transform[])(object)new Transform[modelData.BoneNames.Length]; for (int i = 0; i < array.Length; i++) { Transform transform = new GameObject(modelData.BoneNames[i]) { layer = ((Component)container).gameObject.layer }.transform; int num = modelData.ParentIndices[i]; transform.SetParent((num >= 0) ? array[num] : container, false); transform.localPosition = modelData.BonePositions[i]; transform.localRotation = modelData.BoneRotations[i]; transform.localScale = modelData.BoneScales[i]; array[i] = transform; } return array; } private List BuildMeshes(ModelData modelData, Transform[] skeleton, Transform container, Material template, int layer) { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01e2: Unknown result type (might be due to invalid IL or missing references) List list = new List(modelData.Meshes.Length); Dictionary dictionary = new Dictionary(StringComparer.Ordinal); for (int i = 0; i < modelData.Meshes.Length; i++) { MeshData meshData = modelData.Meshes[i]; Mesh val = new Mesh { name = "mesh" + label + "_" + meshData.MaterialName, indexFormat = (IndexFormat)(meshData.Vertices.Length > 65535), vertices = meshData.Vertices, normals = meshData.Normals, uv = meshData.Uvs, triangles = meshData.Triangles }; GameObject val2 = new GameObject(meshData.MaterialName); val2.layer = layer; Transform transform = val2.transform; transform.SetParent(container, false); BuildCompactSkinningData(meshData.BoneWeights, skeleton, out var compactWeights, out var compactBones, out var bindPoses); val.boneWeights = compactWeights; for (int j = 0; j < compactBones.Length; j++) { bindPoses[j] = compactBones[j].worldToLocalMatrix * transform.localToWorldMatrix; } val.bindposes = bindPoses; val.RecalculateBounds(); string key = meshData.MaterialName + "\n" + meshData.TextureName; if (!dictionary.TryGetValue(key, out var value)) { value = CreateMaterial(template, meshData.MaterialName, meshData.TextureName); dictionary.Add(key, value); } SkinnedMeshRenderer val3 = val2.AddComponent(); val3.sharedMesh = val; val3.bones = compactBones; val3.rootBone = skeleton[0]; ((Renderer)val3).sharedMaterial = value; val3.updateWhenOffscreen = false; Bounds bounds = val.bounds; ((Bounds)(ref bounds)).Expand(3f); ((Renderer)val3).localBounds = bounds; list.Add(new RendererInfo { renderer = (Renderer)(object)val3, defaultMaterial = value, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }); } return list; } private static void BuildCompactSkinningData(BoneWeight[] sourceWeights, Transform[] skeleton, out BoneWeight[] compactWeights, out Transform[] compactBones, out Matrix4x4[] bindPoses) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) SortedSet sortedSet = new SortedSet { 0 }; for (int i = 0; i < sourceWeights.Length; i++) { BoneWeight val = sourceWeights[i]; AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0); AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1); AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2); AddUsedBone(sortedSet, ((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3); } int[] array = new int[sortedSet.Count]; Dictionary dictionary = new Dictionary(sortedSet.Count); int num = 0; foreach (int item in sortedSet) { dictionary[array[num] = item] = num; num++; } compactBones = (Transform[])(object)new Transform[array.Length]; bindPoses = (Matrix4x4[])(object)new Matrix4x4[array.Length]; for (int j = 0; j < array.Length; j++) { compactBones[j] = skeleton[array[j]]; } compactWeights = (BoneWeight[])(object)new BoneWeight[sourceWeights.Length]; for (int k = 0; k < sourceWeights.Length; k++) { BoneWeight val2 = sourceWeights[k]; BoneWeight[] obj = compactWeights; int num2 = k; BoneWeight val3 = default(BoneWeight); ((BoneWeight)(ref val3)).boneIndex0 = Remap(dictionary, ((BoneWeight)(ref val2)).boneIndex0, ((BoneWeight)(ref val2)).weight0); ((BoneWeight)(ref val3)).boneIndex1 = Remap(dictionary, ((BoneWeight)(ref val2)).boneIndex1, ((BoneWeight)(ref val2)).weight1); ((BoneWeight)(ref val3)).boneIndex2 = Remap(dictionary, ((BoneWeight)(ref val2)).boneIndex2, ((BoneWeight)(ref val2)).weight2); ((BoneWeight)(ref val3)).boneIndex3 = Remap(dictionary, ((BoneWeight)(ref val2)).boneIndex3, ((BoneWeight)(ref val2)).weight3); ((BoneWeight)(ref val3)).weight0 = ((BoneWeight)(ref val2)).weight0; ((BoneWeight)(ref val3)).weight1 = ((BoneWeight)(ref val2)).weight1; ((BoneWeight)(ref val3)).weight2 = ((BoneWeight)(ref val2)).weight2; ((BoneWeight)(ref val3)).weight3 = ((BoneWeight)(ref val2)).weight3; obj[num2] = val3; } } private static void AddUsedBone(SortedSet used, int index, float weight) { if (weight > 0f && index >= 0) { used.Add(index); } } private static int Remap(Dictionary localIndex, int index, float weight) { if (weight <= 0f || !localIndex.TryGetValue(index, out var value)) { return 0; } return value; } private Material CreateMaterial(Material template, string materialName, string textureName) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Material val = Object.Instantiate(template); ((Object)val).name = "mat" + label + "_" + materialName; Texture2D texture = LoadTexture(textureName); SetTextureIfPresent(val, "_NormalTex", null); SetTextureIfPresent(val, "_BumpMap", null); SetTextureIfPresent(val, "_EmTex", null); SetTextureIfPresent(val, "_EmissionMap", null); SetTextureIfPresent(val, "_DetailAlbedoMap", null); SetTextureIfPresent(val, "_DetailNormalMap", null); SetTextureIfPresent(val, "_MainTex", (Texture)(object)texture); SetTextureIfPresent(val, "_BaseColorMap", (Texture)(object)texture); SetColorIfPresent(val, "_Color", Color.white); SetColorIfPresent(val, "_MainColor", Color.white); SetColorIfPresent(val, "_EmissionColor", Color.black); SetColorIfPresent(val, "_EmColor", Color.black); val.DisableKeyword("_EMISSION"); val.DisableKeyword("_NORMALMAP"); if (val.HasProperty("_EmPower")) { val.SetFloat("_EmPower", 0f); } if (val.HasProperty("_NormalStrength")) { val.SetFloat("_NormalStrength", 0f); } return val; } private static void SetTextureIfPresent(Material material, string property, Texture texture) { if (material.HasProperty(property)) { material.SetTexture(property, texture); } } private static void SetColorIfPresent(Material material, string property, Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(property)) { material.SetColor(property, color); } } private Texture2D LoadTexture(string textureName) { if (string.IsNullOrEmpty(textureName)) { return null; } if (textureCache.TryGetValue(textureName, out var value)) { return value; } string text = JujutsuAssetPaths.Find("assets", textureDirectoryName, textureName); Texture2D val = null; bool flag = File.Exists(text); TextureAudit.Record(textureDirectoryName, textureName, flag); if (flag) { val = JujutsuTextures.Load(text, "tex" + label + "_" + Path.GetFileNameWithoutExtension(textureName), (TextureWrapMode)1); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)(label + " texture " + textureName + " could not be decoded.")); } } else { Plugin.Log.LogWarning((object)(label + " texture was not found: " + text)); } textureCache[textureName] = val; return val; } private Material FindTemplateMaterial(CharacterModel characterModel) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) RendererInfo[] baseRendererInfos = characterModel.baseRendererInfos; foreach (RendererInfo val in baseRendererInfos) { if (Object.op_Implicit((Object)(object)val.defaultMaterial)) { cachedTemplateMaterial = val.defaultMaterial; return cachedTemplateMaterial; } } Renderer[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { if (Object.op_Implicit((Object)(object)componentsInChildren[j]) && Object.op_Implicit((Object)(object)componentsInChildren[j].sharedMaterial)) { cachedTemplateMaterial = componentsInChildren[j].sharedMaterial; return cachedTemplateMaterial; } } return cachedTemplateMaterial; } private static SkinnedMeshRenderer FindMainRenderer(RendererInfo[] rendererInfos) { SkinnedMeshRenderer result = null; int num = -1; for (int i = 0; i < rendererInfos.Length; i++) { Renderer renderer = rendererInfos[i].renderer; SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null); if (val != null && Object.op_Implicit((Object)(object)val.sharedMesh) && val.sharedMesh.vertexCount > num) { num = val.sharedMesh.vertexCount; result = val; } } return result; } } internal sealed class RuntimeDomainVisual : MonoBehaviour { private const int Shells = 3; private const int Falls = 26; private const int Stars = 64; private const float FallSeconds = 1.9f; private const float FallLength = 0.14f; private readonly List materials = new List(); private Transform[] shells; private Material[] shellMaterials; private LineRenderer[] falls; private Vector3[] fallAxes; private float[] fallOffsets; private float[] fallSpeeds; private LineRenderer[] stars; private Material fallMaterial; private Material starMaterial; private Color fallColour; private Color starColour; private Light domainLight; private Color colour; private Color shellColour; private float radius; private float duration; private float age; internal void Initialize(float domainRadius, float lifetime, Color? tint = null, Color? shellTint = null) { //IL_0037: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_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_008b: Unknown result type (might be due to invalid IL or missing references) radius = Mathf.Max(4f, domainRadius); duration = Mathf.Max(0.5f, lifetime); colour = (Color)(((??)tint) ?? GojoAssets.DomainGlow); shellColour = (Color)(((??)shellTint) ?? colour); BuildShells(); BuildFalls(); BuildStars(); domainLight = JujutsuFxLights.TryAdd(((Component)this).gameObject, Color.Lerp(colour, Color.black, 0.3f), 2.4f, radius * 1.05f, major: true); } private void BuildShells() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) shells = (Transform[])(object)new Transform[3]; shellMaterials = (Material[])(object)new Material[3]; for (int i = 0; i < 3; i++) { GameObject val = JujutsuPrimitives.Sphere("DomainShell_" + i, Vector3.zero, ownMaterial: false); val.transform.SetParent(((Component)this).transform, false); val.transform.localScale = Vector3.one * (radius * (1.98f - (float)i * 0.22f)); shells[i] = val.transform; Renderer component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); Color val2 = Color.Lerp(shellColour, Color.black, (float)i * 0.18f); val2.a = 0.07f; shellMaterials[i] = Track(JujutsuFxMaterials.CreateLineMaterial("matDomainShell" + i, val2, 1f)); component.material = shellMaterials[i]; } } } private void BuildFalls() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) fallColour = Color.Lerp(colour, Color.white, 0.55f); fallColour.a = 0.8f; fallMaterial = Track(JujutsuFxMaterials.CreateLineMaterial("matDomainFalls", fallColour)); falls = (LineRenderer[])(object)new LineRenderer[26]; fallAxes = (Vector3[])(object)new Vector3[26]; fallOffsets = new float[26]; fallSpeeds = new float[26]; for (int i = 0; i < 26; i++) { Vector2 val = Random.insideUnitCircle * (radius * 0.92f); fallAxes[i] = new Vector3(val.x, 0f, val.y); fallOffsets[i] = Random.value; fallSpeeds[i] = Random.Range(0.7f, 1.5f); falls[i] = MakeLine("DomainFall_" + i, fallMaterial, 2); falls[i].widthMultiplier = radius * 0.012f; } } private void BuildStars() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0114: 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) starColour = Color.Lerp(colour, Color.white, 0.8f); starColour.a = 0.9f; starMaterial = Track(JujutsuFxMaterials.CreateLineMaterial("matDomainStars", starColour)); stars = (LineRenderer[])(object)new LineRenderer[64]; Color val4 = default(Color); for (int i = 0; i < 64; i++) { LineRenderer val = MakeLine("DomainStar_" + i, starMaterial, 2); Vector3 val2 = Random.onUnitSphere * (radius * 0.94f); val2.y = Mathf.Abs(val2.y) * 0.9f; Vector3 val3 = Random.onUnitSphere * (radius * 0.012f); val.SetPosition(0, val2 - val3); val.SetPosition(1, val2 + val3); float num = Mathf.Lerp(0.22f, 1f, Mathf.Pow(Random.value, 2.2f)); ((Color)(ref val4))..ctor(num, num, num, 1f); val.startColor = val4; val.endColor = val4; val.widthMultiplier = radius * Mathf.Lerp(0.004f, 0.011f, num); stars[i] = val; } } private LineRenderer MakeLine(string lineName, Material material, int points) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(lineName); val.transform.SetParent(((Component)this).transform, false); LineRenderer obj = val.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)obj); obj.useWorldSpace = false; obj.positionCount = points; obj.numCapVertices = 2; ((Renderer)obj).material = material; return obj; } private Material Track(Material material) { if (Object.op_Implicit((Object)(object)material)) { materials.Add(material); } return material; } private void Update() { //IL_0058: 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) age += Time.deltaTime; float num = Mathf.Clamp01(age / 0.55f); float num2 = Mathf.Clamp01((duration - age) / 0.65f); float num3 = Mathf.Min(num, num2); UpdateShells(num3); UpdateFalls(num3); JujutsuFxMaterials.SetEnvelope(fallMaterial, fallColour, num3); JujutsuFxMaterials.SetEnvelope(starMaterial, starColour, num3 * (0.75f + Mathf.Sin(age * 2.4f) * 0.25f)); if (Object.op_Implicit((Object)(object)domainLight)) { domainLight.intensity = (2.4f + Mathf.Sin(age * 6f) * 0.45f) * num3; } if (age >= duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void UpdateShells(float alpha) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < shells.Length; i++) { if (Object.op_Implicit((Object)(object)shells[i])) { shells[i].Rotate((3f + (float)i * 2f) * Time.deltaTime, (7f - (float)i * 3f) * Time.deltaTime, 0f, (Space)1); Color baseColour = Color.Lerp(shellColour, Color.black, (float)i * 0.18f); baseColour.a = 0.07f; JujutsuFxMaterials.SetEnvelope(shellMaterials[i], baseColour, alpha); } } } private void UpdateFalls(float alpha) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) float num = radius * 0.95f; float num2 = (0f - radius) * 0.05f; for (int i = 0; i < falls.Length; i++) { LineRenderer val = falls[i]; if (Object.op_Implicit((Object)(object)val)) { float num3 = Mathf.Repeat(fallOffsets[i] + age * fallSpeeds[i] / 1.9f, 1f); float num4 = Mathf.Lerp(num, num2, num3); float num5 = num4 + radius * 0.14f; Vector3 val2 = fallAxes[i]; val.SetPosition(0, new Vector3(val2.x, num5, val2.z)); val.SetPosition(1, new Vector3(val2.x, num4, val2.z)); float num6 = Mathf.Min(new float[3] { num3 / 0.12f, (1f - num3) / 0.12f, 1f }); val.widthMultiplier = radius * 0.012f * alpha * Mathf.Clamp01(num6); } } } private void OnDestroy() { for (int i = 0; i < materials.Count; i++) { if (Object.op_Implicit((Object)(object)materials[i])) { Object.Destroy((Object)(object)materials[i]); } } materials.Clear(); } } internal static class RuntimeShrineModel { private const string ModelFileName = "shrine.model"; private const string TextureFolder = "shrine"; private const float TargetHeight = 13f; private static Mesh[] cachedMeshes; private static Material[] cachedMaterials; private static bool loadFailed; private static float lastReportAt = -999f; private static Bounds ModelBounds { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = cachedMeshes[0].bounds; for (int i = 1; i < cachedMeshes.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(cachedMeshes[i].bounds); } return bounds; } } private static float ScaleFactor { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Bounds modelBounds = ModelBounds; float y = ((Bounds)(ref modelBounds)).size.y; if (!(y > 0.001f)) { return 1f; } return 13f / y; } } internal static bool TryBuild(Transform parent, out float height) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0067: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) height = 0f; if (loadFailed || !Object.op_Implicit((Object)(object)parent)) { return false; } if (!EnsureLoaded()) { return false; } float scaleFactor = ScaleFactor; Bounds modelBounds = ModelBounds; float num = (0f - ((Bounds)(ref modelBounds)).min.y) * scaleFactor; for (int i = 0; i < cachedMeshes.Length; i++) { GameObject val = new GameObject("ShrinePart_" + i); val.transform.SetParent(parent, false); val.transform.localPosition = Vector3.up * num; val.transform.localScale = Vector3.one * scaleFactor; val.AddComponent().sharedMesh = cachedMeshes[i]; MeshRenderer obj = val.AddComponent(); ((Renderer)obj).sharedMaterial = cachedMaterials[i]; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)obj).receiveShadows = true; } height = 13f; return true; } internal static void ReportPlacement(Transform shrine, Transform domainRoot, Vector3 centre, float groundDrop) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)shrine) || !Object.op_Implicit((Object)(object)domainRoot) || Time.time - lastReportAt < 5f) { return; } lastReportAt = Time.time; MeshRenderer[] componentsInChildren = ((Component)shrine).GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { Plugin.Log.LogWarning((object)"Malevolent Shrine: built, but no renderer came with it."); return; } Bounds bounds = ((Renderer)componentsInChildren[0]).bounds; for (int i = 1; i < componentsInChildren.Length; i++) { ((Bounds)(ref bounds)).Encapsulate(((Renderer)componentsInChildren[i]).bounds); } Vector3 val = ((Bounds)(ref bounds)).center - centre; val.y = 0f; Plugin.Log.LogInfo((object)($"Malevolent Shrine stands at {((Bounds)(ref bounds)).center}, size " + $"{((Bounds)(ref bounds)).size}, base {((Bounds)(ref bounds)).min.y:0.0}, top {((Bounds)(ref bounds)).max.y:0.0}; " + $"domain centre {centre}, root {domainRoot.position}, " + $"{((Vector3)(ref val)).magnitude:0.0}m out from the caster, floor found " + $"{groundDrop:0.0}m from his own.")); StringBuilder stringBuilder = new StringBuilder(); foreach (MeshRenderer val2 in componentsInChildren) { MeshFilter component = ((Component)val2).GetComponent(); if (stringBuilder.Length > 0) { stringBuilder.Append("; "); } stringBuilder.Append($"{((Object)val2).name} enabled={((Renderer)val2).enabled} " + "mesh=" + ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.sharedMesh)) ? component.sharedMesh.vertexCount.ToString() : "NONE") + " mat=" + (Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial) ? ((Object)((Renderer)val2).sharedMaterial.shader).name : "NONE")); } Plugin.Log.LogInfo((object)("Malevolent Shrine parts: " + stringBuilder)); } private static bool EnsureLoaded() { if (cachedMeshes != null) { return true; } string text = JujutsuAssetPaths.Find("assets", "shrine.model"); if (!File.Exists(text)) { loadFailed = true; Plugin.Log.LogWarning((object)("Malevolent Shrine model was not found at " + text + "; the domain will draw its old blocks instead.")); return false; } try { Read(text); Plugin.Log.LogInfo((object)($"Malevolent Shrine: {cachedMeshes.Length} parts, " + $"scaled by {ScaleFactor:0.0} to {13f} metres.")); return true; } catch (Exception arg) { loadFailed = true; cachedMeshes = null; cachedMaterials = null; Plugin.Log.LogWarning((object)("Malevolent Shrine model could not be read; the domain " + $"will draw its old blocks instead: {arg}")); return false; } } private static void Read(string path) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_0186: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown using FileStream input = File.OpenRead(path); using BinaryReader binaryReader = new BinaryReader(input); string text = new string(binaryReader.ReadChars(8)); if (text != "SUKNMDL1") { throw new InvalidDataException("Bad magic '" + text + "'."); } int num = binaryReader.ReadInt32(); if (num != 2) { throw new InvalidDataException($"Bad version {num}."); } int num2 = binaryReader.ReadInt32(); for (int i = 0; i < num2; i++) { binaryReader.ReadString(); binaryReader.ReadInt32(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); } int num3 = binaryReader.ReadInt32(); List list = new List(num3); List list2 = new List(num3); Dictionary dictionary = new Dictionary(StringComparer.Ordinal); for (int j = 0; j < num3; j++) { string text2 = binaryReader.ReadString(); binaryReader.ReadInt32(); string materialName = binaryReader.ReadString(); string text3 = binaryReader.ReadString(); binaryReader.ReadByte(); int num4 = binaryReader.ReadInt32(); Vector3[] array = (Vector3[])(object)new Vector3[num4]; Vector3[] array2 = (Vector3[])(object)new Vector3[num4]; Vector2[] array3 = (Vector2[])(object)new Vector2[num4]; for (int k = 0; k < num4; k++) { array[k] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); array2[k] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); array3[k] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); } int num5 = binaryReader.ReadInt32(); int[] array4 = new int[num5]; for (int l = 0; l < num5; l++) { array4[l] = binaryReader.ReadInt32(); } Mesh val = new Mesh { name = "meshShrine" + text2, indexFormat = (IndexFormat)1, hideFlags = (HideFlags)61 }; val.vertices = array; val.normals = array2; val.uv = array3; val.triangles = array4; val.RecalculateBounds(); list.Add(val); if (!dictionary.TryGetValue(text3, out var value)) { value = (dictionary[text3] = BuildMaterial(materialName, text3)); } list2.Add(value); } cachedMeshes = list.ToArray(); cachedMaterials = list2.ToArray(); } private static Material BuildMaterial(string materialName, string textureName) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) Material val = JujutsuFxMaterials.CreateSurfaceMaterial("matShrine" + materialName, Color.white); if (!Object.op_Implicit((Object)(object)val)) { return null; } ((Object)val).hideFlags = (HideFlags)61; Texture2D val2 = GojoAssets.LoadPersistentTexture("shrine/" + textureName, "texShrine" + materialName); if (Object.op_Implicit((Object)(object)val2) && val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)val2); } if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); val.DisableKeyword("_EMISSION"); } return val; } } internal static class RuntimeVisuals { internal static RuntimeOrbVisual CreateOrb(Vector3 position, Color color, float radius, float trailTime = 0f, GojoTechniqueStyle style = GojoTechniqueStyle.Red) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) GameObject val = null; try { val = CreateSphereObject("GojoControlledOrb", position, color); RuntimeOrbVisual runtimeOrbVisual = val.AddComponent(); runtimeOrbVisual.Initialize(color, radius); GojoOrbShell.Attach(val, color, style); return runtimeOrbVisual; } catch (Exception arg) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } Plugin.Log.LogError((object)$"Could not create Gojo orb visual: {arg}"); return null; } } internal static RuntimeDomainVisual CreateDomain(Vector3 position, float radius, float duration, Color? tint = null, Color? shellTint = null) { //IL_0005: 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) GameObject val = new GameObject("GojoUnlimitedVoid"); val.transform.position = position; RuntimeDomainVisual runtimeDomainVisual = val.AddComponent(); runtimeDomainVisual.Initialize(radius, duration, tint, shellTint); return runtimeDomainVisual; } private static GameObject CreateSphereObject(string name, Vector3 position, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) GameObject val = JujutsuPrimitives.Sphere(name, position, ownMaterial: false); Renderer component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { JujutsuFxMaterials.PrepareRenderer(component); Color colour = color; colour.a = 0.7f; Material val2 = JujutsuFxMaterials.CreateLineMaterial("matGojoOrbCore", colour, 1.35f); if (Object.op_Implicit((Object)(object)val2)) { component.material = val2; JujutsuFxMaterials.Claim(val, val2); } else { TintExistingMaterial(component, color); } } return val; } private static void TintExistingMaterial(Renderer renderer, Color color) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)renderer)) { Material material = renderer.material; ((Object)material).name = "matGojoRuntimeEffect"; JujutsuFxMaterials.SetTint(material, color); SetColorIfPresent(material, "_EmColor", color * 2f); JujutsuFxMaterials.PrepareRenderer(renderer); renderer.material = material; JujutsuFxMaterials.Claim(((Component)renderer).gameObject, material); } } private static void SetColorIfPresent(Material material, string propertyName, Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (material.HasProperty(propertyName)) { material.SetColor(propertyName, color); } } } internal sealed class RuntimeOrbVisual : MonoBehaviour { private Renderer targetRenderer; private Light pointLight; private Color color; private float radius; private float pulseAge; private float pulseBoost; private bool released; internal void Initialize(Color tint, float initialRadius) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) color = tint; radius = initialRadius; targetRenderer = ((Component)this).GetComponent(); ((Component)this).transform.localScale = Vector3.one * radius; pointLight = JujutsuFxLights.TryAdd(((Component)this).gameObject, color, 3.5f, Mathf.Max(5f, radius * 5f), major: true); } internal void SetPosition(Vector3 worldPosition) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = worldPosition; } internal void SetRadius(float newRadius) { radius = Mathf.Max(0.05f, newRadius); } internal void TriggerPulse(float strength = 0.22f) { pulseBoost = Mathf.Max(pulseBoost, Mathf.Clamp(strength, 0.05f, 0.5f)); } internal void BurstAndDestroy(float endScale, float duration) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (!released) { released = true; if (Object.op_Implicit((Object)(object)pointLight)) { ((Behaviour)pointLight).enabled = false; } ((Component)this).gameObject.AddComponent().Initialize(targetRenderer, ((Component)this).transform.localScale.x, endScale, duration, color); Object.Destroy((Object)(object)this); } } private void Update() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) pulseAge += Time.deltaTime; pulseBoost = Mathf.MoveTowards(pulseBoost, 0f, Time.deltaTime * 1.8f); float num = 1f + Mathf.Sin(pulseAge * 9f) * 0.06f + pulseBoost; ((Component)this).transform.localScale = Vector3.one * radius * num; if (Object.op_Implicit((Object)(object)pointLight)) { pointLight.intensity = 3.5f + Mathf.Sin(pulseAge * 11f) * 0.6f + pulseBoost * 12f; pointLight.range = Mathf.Max(5f, radius * (5f + pulseBoost * 5f)); } } } internal sealed class RuntimeOrbFade : MonoBehaviour { private Renderer targetRenderer; private float startScale; private float endScale; private float duration; private Color color; private float age; internal void Initialize(Renderer renderer, float from, float to, float lifetime, Color tint) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) targetRenderer = renderer; startScale = from; endScale = to; duration = Mathf.Max(0.05f, lifetime); color = tint; ((Component)this).transform.localScale = Vector3.one * startScale; if (Object.op_Implicit((Object)(object)targetRenderer)) { JujutsuFxMaterials.ConfigureTransparent(targetRenderer.material); } } private void Update() { //IL_002b: 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_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_007d: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float num = Mathf.Clamp01(age / duration); ((Component)this).transform.localScale = Vector3.one * Mathf.Lerp(startScale, endScale, num); if (Object.op_Implicit((Object)(object)targetRenderer)) { Color colour = color; colour.a *= 1f - num; JujutsuFxMaterials.SetTint(targetRenderer.material, colour); } if (age >= duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } internal sealed class SukunaMixamoAnimationDriver : MonoBehaviour { private readonly struct StrikeWindow { private readonly float impact; private readonly float lead; private readonly float follow; private const float SlowestRecovery = 0.75f; internal StrikeWindow(float impact, float lead, float follow) { this.impact = impact; this.lead = lead; this.follow = follow; } internal float Sample(float phase, float stateDuration, float hitPhase) { float num = Mathf.Max(0.05f, stateDuration); float num2 = Mathf.Clamp01(phase); float num3 = Mathf.Clamp01(hitPhase); if (num2 < num3) { float num4 = (num3 - num2) * num; return impact - Mathf.Min(lead, num4 * LeadRate(lead, num3 * num)); } float num5 = (num2 - num3) * num; return impact + Mathf.Min(follow, num5 * FollowRate(follow, (1f - num3) * num)); } private static float LeadRate(float clipSeconds, float stateSeconds) { return Mathf.Max(1f, clipSeconds / Mathf.Max(0.001f, stateSeconds)); } private static float FollowRate(float clipSeconds, float stateSeconds) { return Mathf.Max(0.75f, clipSeconds / Mathf.Max(0.001f, stateSeconds)); } } private sealed class BoneLink { internal int SourceIndex; internal Transform Target; internal bool IsHips; internal bool IsLower; internal Quaternion TargetBindRelative; } private sealed class AnimationLibrary { internal string[] BoneNames; internal Vector3[] BindPositions; internal Quaternion[] BindRotations; internal readonly Dictionary BoneIndices = new Dictionary(StringComparer.Ordinal); internal readonly Dictionary Clips = new Dictionary(StringComparer.Ordinal); } private sealed class AnimationClipData { internal string Name; internal bool Loop; internal float Duration; internal int SampleCount; internal Vector3[] HipsPositions; internal Quaternion[] Rotations; internal Quaternion[] BindRotations; internal Vector3 BindHipsPosition; internal Vector3 HipsTravel; internal bool HipsSwayFollowed; } private const string AnimationFileName = "sukuna.anim"; internal const string YujiAnimationFileName = "yuji.anim"; internal const string TodoAnimationFileName = "todo.anim"; private const float TransitionDuration = 0.12f; private const float StrikeTransitionDuration = 0.03f; private const float AirborneTransitionDuration = 0.28f; private const float PhaseRewind = 0.1f; private const float BindGapHold = 0.05f; private const float MaximumFollowedHipsSway = 0.15f; private static readonly StrikeWindow[] SukunaFistFightStrikes = new StrikeWindow[4] { new StrikeWindow(1.57f, 0.396f, 0.8f), new StrikeWindow(0.9f, 0.461f, 0.45f), new StrikeWindow(2.73f, 0.576f, 0.86f), new StrikeWindow(4.03f, 0.864f, 0.63f) }; private static readonly StrikeWindow YujiStompStrike = new StrikeWindow(0.75f, 0.4f, 0.6f); private static readonly StrikeWindow SukunaSpinKickStrike = new StrikeWindow(0.73f, 0.346f, 0.374f); private static readonly StrikeWindow[] TodoFistFightStrikes = new StrikeWindow[7] { new StrikeWindow(1.2f, 0.6f, 0.25f), new StrikeWindow(1.7f, 0.25f, 0.32f), new StrikeWindow(2.33f, 0.32f, 0.33f), new StrikeWindow(3f, 0.33f, 0.32f), new StrikeWindow(3.63f, 0.32f, 0.15f), new StrikeWindow(3.93f, 0.15f, 0.2f), new StrikeWindow(4.3f, 0.2f, 0.37f) }; private static readonly StrikeWindow TodoSpinKickStrike = new StrikeWindow(0.87f, 0.55f, 0.55f); private static readonly StrikeWindow[] YujiFistFightStrikes = new StrikeWindow[2] { new StrikeWindow(0.833f, 0.294f, 0.5f), new StrikeWindow(1.533f, 0.294f, 0.63f) }; private static readonly StrikeWindow YujiSpinKickStrike = new StrikeWindow(0.733f, 0.294f, 0.63f); private static readonly Quaternion SourceToTargetBasis = Quaternion.AngleAxis(90f, Vector3.right); private static readonly Quaternion TargetToSourceBasis = Quaternion.Inverse(SourceToTargetBasis); private Quaternion sourceBasis = SourceToTargetBasis; private static readonly string[,] BoneMap = new string[52, 2] { { "mixamorig:Hips", "root.x" }, { "mixamorig:Spine", "spine_str_cns_01.x" }, { "mixamorig:Spine1", "spine_str_cns_02.x" }, { "mixamorig:Spine2", "spine_str_cns_03.x" }, { "mixamorig:Neck", "neck.x" }, { "mixamorig:Head", "head.x" }, { "mixamorig:LeftShoulder", "shoulder.l" }, { "mixamorig:LeftArm", "arm_stretch.l" }, { "mixamorig:LeftForeArm", "forearm_stretch.l" }, { "mixamorig:LeftHand", "hand.l" }, { "mixamorig:RightShoulder", "shoulder.r" }, { "mixamorig:RightArm", "arm_stretch.r" }, { "mixamorig:RightForeArm", "forearm_stretch.r" }, { "mixamorig:RightHand", "hand.r" }, { "mixamorig:LeftUpLeg", "thigh_stretch.l" }, { "mixamorig:LeftLeg", "leg_stretch.l" }, { "mixamorig:LeftFoot", "foot.l" }, { "mixamorig:LeftToeBase", "toes_01.l" }, { "mixamorig:RightUpLeg", "thigh_stretch.r" }, { "mixamorig:RightLeg", "leg_stretch.r" }, { "mixamorig:RightFoot", "foot.r" }, { "mixamorig:RightToeBase", "toes_01.r" }, { "mixamorig:LeftHandThumb1", "thumb1.l" }, { "mixamorig:LeftHandThumb2", "c_thumb2.l" }, { "mixamorig:LeftHandThumb3", "c_thumb3.l" }, { "mixamorig:LeftHandIndex1", "index1.l" }, { "mixamorig:LeftHandIndex2", "c_index2.l" }, { "mixamorig:LeftHandIndex3", "c_index3.l" }, { "mixamorig:LeftHandMiddle1", "middle1.l" }, { "mixamorig:LeftHandMiddle2", "c_middle2.l" }, { "mixamorig:LeftHandMiddle3", "c_middle3.l" }, { "mixamorig:LeftHandRing1", "ring1.l" }, { "mixamorig:LeftHandRing2", "c_ring2.l" }, { "mixamorig:LeftHandRing3", "c_ring3.l" }, { "mixamorig:LeftHandPinky1", "pinky1.l" }, { "mixamorig:LeftHandPinky2", "c_pinky2.l" }, { "mixamorig:LeftHandPinky3", "c_pinky3.l" }, { "mixamorig:RightHandThumb1", "thumb1.r" }, { "mixamorig:RightHandThumb2", "c_thumb2.r" }, { "mixamorig:RightHandThumb3", "c_thumb3.r" }, { "mixamorig:RightHandIndex1", "index1.r" }, { "mixamorig:RightHandIndex2", "c_index2.r" }, { "mixamorig:RightHandIndex3", "c_index3.r" }, { "mixamorig:RightHandMiddle1", "middle1.r" }, { "mixamorig:RightHandMiddle2", "c_middle2.r" }, { "mixamorig:RightHandMiddle3", "c_middle3.r" }, { "mixamorig:RightHandRing1", "ring1.r" }, { "mixamorig:RightHandRing2", "c_ring2.r" }, { "mixamorig:RightHandRing3", "c_ring3.r" }, { "mixamorig:RightHandPinky1", "pinky1.r" }, { "mixamorig:RightHandPinky2", "c_pinky2.r" }, { "mixamorig:RightHandPinky3", "c_pinky3.r" } }; private static readonly Dictionary libraryCache = new Dictionary(StringComparer.Ordinal); private static readonly HashSet libraryLoadAttempted = new HashSet(StringComparer.Ordinal); private AnimationLibrary cachedLibrary; private int appliedSkin = -1; private ModelSkinController skinController; private bool skinControllerResolved; [SerializeField] private string animationFileName = "sukuna.anim"; private bool gojoClipSet; private bool yujiClipSet; private bool todoClipSet; [SerializeField] private string[] bindBoneNames; [SerializeField] private Quaternion[] bindRotations; private readonly List links = new List(); private Quaternion[] lastRelativeRotations; private Quaternion[] lastLocalRotations; private Quaternion[] transitionRotations; private Quaternion[] rotationOffsets; private Quaternion[] lowerOffsets; private string lowerOffsetsClipName; private Vector3 lowerClipHipsBindPosition; private string offsetsClipName; private Vector3 clipHipsBindPosition; private string activeClipName; private GojoCpuPose enteringPose; private GojoCpuPose leavingPose; private float transitionStartedAt; private float lastStretchPhase; private const string IdleVariantClip = "IdleVariant"; private const float IdleVariantInterval = 9f; private const float IdleVariantChance = 0.45f; private float nextIdleRollAt; private float idleVariantUntil; private float idleVariantStartedAt; private List idleVariants; private string idleVariantsFor; private string currentIdleVariant; private float lastAppliedAt = -1000f; private bool initializationAttempted; private readonly HashSet reportedPoses = new HashSet(StringComparer.Ordinal); private bool nativeMixamoRig; private Transform nativeHips; private Transform nativeLeftArm; private Transform nativeLeftForearm; private Transform nativeRightArm; private Transform nativeRightForearm; private int hipsLinkIndex = -1; private Vector3 nativeHipsBindLocalPosition; private bool ready; private bool followHips = true; private static readonly string[] BorrowedClips = new string[4] { "Walk", "Run", "RunBackward", "Fall" }; private const string LowerClipPrefix = "Lower_"; private Quaternion[] firstOffsets; private string firstOffsetsClip; private readonly HashSet reportedOffsets = new HashSet(); private const float StaticYawSpreadLimit = 2f; private const float StaticYawMinimum = 8f; internal bool HasShinjukuFlight { get { int num = CurrentSkin(); bool flag = num >= 0 && GojoExtraSkins.WardrobeModelForSkin(num) == "shinjuku.model" && cachedLibrary != null && cachedLibrary.Clips.ContainsKey("FlightShinjuku"); if (reportedPoses.Add($"authored {num} {flag}")) { Plugin.Log.LogInfo((object)($"Gojo flight clip on {((Object)this).name}: skin {num}, wardrobe " + (GojoExtraSkins.WardrobeModelForSkin(num) ?? "none") + ", library " + ((cachedLibrary == null) ? "not loaded" : "loaded") + ", FlightShinjuku " + ((cachedLibrary != null && cachedLibrary.Clips.ContainsKey("FlightShinjuku")) ? "present" : "absent") + " -> " + (flag ? "its own" : "shared Flight") + ".")); } return flag; } } internal bool IsGojoClipSet => gojoClipSet; private void ReportArm(GojoCpuPose pose, string boneName) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) int num = links.FindIndex((BoneLink link) => Object.op_Implicit((Object)(object)link.Target) && ((Object)link.Target).name == boneName); if (num >= 0) { Quaternion val = RelativeRotation(links[num].Target); Quaternion targetBindRelative = links[num].TargetBindRelative; Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; Vector3 eulerAngles2 = ((Quaternion)(ref targetBindRelative)).eulerAngles; Plugin.Log.LogInfo((object)($"Sukuna {pose} {boneName}: applied=" + $"({eulerAngles.x:0}, {eulerAngles.y:0}, " + $"{eulerAngles.z:0}) rest=({eulerAngles2.x:0}, " + $"{eulerAngles2.y:0}, {eulerAngles2.z:0}) " + $"delta={Quaternion.Angle(val, targetBindRelative):0.0} deg " + "on " + (Object.op_Implicit((Object)(object)((Component)this).transform.root) ? ((Object)((Component)this).transform.root).name : ((Object)this).name) + ".")); } } private void WriteRelativeRotations(Quaternion[] relative) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < links.Count; i++) { BoneLink boneLink = links[i]; if (Object.op_Implicit((Object)(object)boneLink.Target)) { boneLink.Target.localRotation = (Object.op_Implicit((Object)(object)boneLink.Target.parent) ? (Quaternion.Inverse(RelativeRotation(boneLink.Target.parent)) * relative[i]) : relative[i]); } } } private string ChooseIdleClip(string standing) { List list = IdleVariants(); if (list == null || list.Count == 0) { return standing; } if (Time.time < idleVariantUntil) { return currentIdleVariant ?? standing; } if (Time.time >= nextIdleRollAt) { nextIdleRollAt = Time.time + 9f; if (Random.value < 0.45f) { string text = list[Random.Range(0, list.Count)]; if (!cachedLibrary.Clips.TryGetValue(text, out var value)) { return standing; } currentIdleVariant = text; idleVariantStartedAt = Time.time; idleVariantUntil = Time.time + value.Duration; return text; } } return standing; } private List IdleVariants() { if (cachedLibrary == null) { return null; } if (idleVariants != null && string.Equals(idleVariantsFor, animationFileName, StringComparison.Ordinal)) { return idleVariants; } idleVariants = new List(); if (cachedLibrary.Clips.ContainsKey("IdleVariant")) { idleVariants.Add("IdleVariant"); int num = 2; while (true) { string text = "IdleVariant" + num; if (!cachedLibrary.Clips.ContainsKey(text)) { break; } idleVariants.Add(text); num++; } } idleVariantsFor = animationFileName; Plugin.Log.LogInfo((object)("Sukuna idle breaks in '" + animationFileName + "': " + ((idleVariants.Count == 0) ? "none, the single idle stands" : string.Join(", ", idleVariants)))); return idleVariants; } private bool IsUnanswerable(GojoCpuPose pose) { if (cachedLibrary == null) { return true; } switch (pose) { case GojoCpuPose.Walk: case GojoCpuPose.Sprint: case GojoCpuPose.RunBackward: if (!cachedLibrary.Clips.ContainsKey("Run")) { return !cachedLibrary.Clips.ContainsKey("Walk"); } return false; case GojoCpuPose.Jump: case GojoCpuPose.Fall: return !cachedLibrary.Clips.ContainsKey("Fall"); default: return false; } } private static bool IsAirborne(GojoCpuPose pose) { if (pose != GojoCpuPose.Fall && pose != GojoCpuPose.Jump) { return pose == GojoCpuPose.Flight; } return true; } private int CurrentSkin() { if (!skinControllerResolved) { skinControllerResolved = true; skinController = ((Component)this).GetComponentInParent(); } if (!Object.op_Implicit((Object)(object)skinController)) { return appliedSkin; } return skinController.currentSkinIndex; } internal static void NotifySkinApplied(GameObject root, int skinIndex) { if (Object.op_Implicit((Object)(object)root)) { SukunaMixamoAnimationDriver[] componentsInChildren = root.GetComponentsInChildren(true); SukunaMixamoAnimationDriver[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { array[i].appliedSkin = skinIndex; } Plugin.Log.LogInfo((object)($"Skin {skinIndex} announced to {componentsInChildren.Length} animation " + "driver(s) on " + ((Object)root).name + "; wardrobe " + (GojoExtraSkins.WardrobeModelForSkin(skinIndex) ?? "none") + ".")); } } internal void UseSourceBasis(Quaternion basis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) sourceBasis = basis; } internal void UseHipsTranslation(bool follow) { followHips = follow; } internal void UseAnimationFile(string fileName) { if (!string.IsNullOrEmpty(fileName)) { animationFileName = fileName; ResolveClipSet(); } } private void ResolveClipSet() { gojoClipSet = animationFileName == "gojo.anim"; yujiClipSet = animationFileName == "yuji.anim"; todoClipSet = animationFileName == "todo.anim"; } internal void Configure(string[] targetNames, Transform[] targetBones) { Configure(targetNames, targetBones, null); } internal void Configure(string[] targetNames, Transform[] targetBones, Quaternion[] restRotations) { initializationAttempted = true; CaptureBindPose(targetNames, targetBones, restRotations); Initialize(targetNames, targetBones); } private void CaptureBindPose(string[] targetNames, Transform[] targetBones, Quaternion[] restRotations) { //IL_004f: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Min((targetNames != null) ? targetNames.Length : 0, (targetBones != null) ? targetBones.Length : 0); if (num > 0) { bindBoneNames = new string[num]; bindRotations = (Quaternion[])(object)new Quaternion[num]; for (int i = 0; i < num; i++) { bindBoneNames[i] = targetNames[i]; bool flag = restRotations != null && i < restRotations.Length && IsRotation(restRotations[i]); bindRotations[i] = (flag ? restRotations[i] : (Object.op_Implicit((Object)(object)targetBones[i]) ? RelativeRotation(targetBones[i]) : Quaternion.identity)); } ReportCapturedArms(targetNames, targetBones); } } private Quaternion RelativeRotation(Transform bone) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return RelativeRotation(((Component)this).transform, bone); } internal static Quaternion RelativeRotation(Transform container, Transform bone) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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) Quaternion val = Quaternion.identity; Transform val2 = bone; while (Object.op_Implicit((Object)(object)val2)) { if ((Object)(object)val2 == (Object)(object)container) { return val; } val = val2.localRotation * val; val2 = val2.parent; } return Quaternion.Inverse(container.rotation) * bone.rotation; } private static bool IsRotation(Quaternion rotation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) return rotation.x * rotation.x + rotation.y * rotation.y + rotation.z * rotation.z + rotation.w * rotation.w > 0.5f; } private void ReportCapturedArms(string[] targetNames, Transform[] targetBones) { Plugin.Log.LogInfo((object)("Sukuna bind captured on " + DescribeOwner() + ": " + DescribeCapturedBone("mixamorig:LeftArm") + ", " + DescribeCapturedBone("mixamorig:RightArm") + ", " + DescribeCapturedBone("mixamorig:LeftForeArm") + ".")); Plugin.Log.LogInfo((object)("Sukuna arm placement on " + DescribeOwner() + ": " + DescribeBoneSide(targetNames, targetBones, "mixamorig:LeftArm") + ", " + DescribeBoneSide(targetNames, targetBones, "mixamorig:RightArm") + ", scales " + DescribeScaleChain() + ".")); } private string DescribeOwner() { Transform val = ((Component)this).transform; while (Object.op_Implicit((Object)(object)val.parent) && Object.op_Implicit((Object)(object)val.parent.parent)) { val = val.parent; } return ((Object)val).name; } private string DescribeBoneSide(string[] targetNames, Transform[] targetBones, string boneName) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) string text = boneName.Replace("mixamorig:", string.Empty); int num = Mathf.Min((targetNames != null) ? targetNames.Length : 0, (targetBones != null) ? targetBones.Length : 0); for (int i = 0; i < num; i++) { if (string.Equals(targetNames[i], boneName, StringComparison.Ordinal) && Object.op_Implicit((Object)(object)targetBones[i])) { Vector3 localPosition = targetBones[i].localPosition; return $"{text}=({localPosition.x:0.###}, " + $"{localPosition.y:0.###}, {localPosition.z:0.###})"; } } return text + "=missing"; } private string DescribeScaleChain() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_0079: 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_0099: Unknown result type (might be due to invalid IL or missing references) string text = string.Empty; Transform val = ((Component)this).transform; while (Object.op_Implicit((Object)(object)val)) { Vector3 localScale = val.localScale; text = text + $"{((Object)val).name}=({localScale.x:0.###}, " + $"{localScale.y:0.###}, {localScale.z:0.###}) "; val = val.parent; } Vector3 lossyScale = ((Component)this).transform.lossyScale; return $"{text}lossy=({lossyScale.x:0.###}, " + $"{lossyScale.y:0.###}, {lossyScale.z:0.###})"; } private string DescribeCapturedBone(string boneName) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!TryGetCapturedBind(boneName, out var bindRotation)) { return boneName + "=missing"; } Vector3 eulerAngles = ((Quaternion)(ref bindRotation)).eulerAngles; string text = boneName.Replace("mixamorig:", string.Empty); return $"{text}=({eulerAngles.x:0}, {eulerAngles.y:0}, {eulerAngles.z:0})"; } private bool TryGetCapturedBind(string targetName, out Quaternion bindRotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) bindRotation = Quaternion.identity; if (bindBoneNames == null || bindRotations == null || bindBoneNames.Length != bindRotations.Length) { return false; } for (int i = 0; i < bindBoneNames.Length; i++) { if (string.Equals(bindBoneNames[i], targetName, StringComparison.Ordinal)) { bindRotation = bindRotations[i]; return true; } } return false; } private void EnsureInitialized() { if (!ready && !initializationAttempted) { initializationAttempted = true; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); string[] array = new string[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = ((Object)componentsInChildren[i]).name; } Initialize(array, componentsInChildren); } } private void Initialize(string[] targetNames, Transform[] targetBones) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) try { links.Clear(); ResolveClipSet(); AnimationLibrary animationLibrary = LoadAnimationLibrary(animationFileName); if (animationLibrary == null) { return; } BorrowLocomotion(animationLibrary); cachedLibrary = animationLibrary; Dictionary dictionary = new Dictionary(StringComparer.Ordinal); int num = Mathf.Min((targetNames != null) ? targetNames.Length : 0, (targetBones != null) ? targetBones.Length : 0); for (int i = 0; i < num; i++) { if (Object.op_Implicit((Object)(object)targetBones[i])) { dictionary[targetNames[i]] = targetBones[i]; } } nativeMixamoRig = dictionary.ContainsKey("mixamorig:Hips"); if (nativeMixamoRig) { nativeHips = dictionary["mixamorig:Hips"]; dictionary.TryGetValue("mixamorig:LeftArm", out nativeLeftArm); dictionary.TryGetValue("mixamorig:LeftForeArm", out nativeLeftForearm); dictionary.TryGetValue("mixamorig:RightArm", out nativeRightArm); dictionary.TryGetValue("mixamorig:RightForeArm", out nativeRightForearm); nativeHipsBindLocalPosition = nativeHips.localPosition; } for (int j = 0; j < BoneMap.GetLength(0); j++) { string text = BoneMap[j, 0]; string text2 = (nativeMixamoRig ? text : BoneMap[j, 1]); if (animationLibrary.BoneIndices.TryGetValue(text, out var value) && dictionary.TryGetValue(text2, out var value2) && Object.op_Implicit((Object)(object)value2)) { Quaternion bindRotation; Quaternion targetBindRelative = (TryGetCapturedBind(text2, out bindRotation) ? bindRotation : RelativeRotation(value2)); if (text == "mixamorig:Hips") { hipsLinkIndex = links.Count; } links.Add(new BoneLink { SourceIndex = value, Target = value2, IsHips = (text == "mixamorig:Hips"), IsLower = IsLowerBodyBone(text), TargetBindRelative = targetBindRelative }); } } if (links.Count < 22) { throw new InvalidDataException($"Only {links.Count} Mixamo-to-Sukuna bones were resolved."); } lastRelativeRotations = (Quaternion[])(object)new Quaternion[links.Count]; lastLocalRotations = (Quaternion[])(object)new Quaternion[links.Count]; transitionRotations = (Quaternion[])(object)new Quaternion[links.Count]; rotationOffsets = (Quaternion[])(object)new Quaternion[links.Count]; lowerOffsets = (Quaternion[])(object)new Quaternion[links.Count]; lowerOffsetsClipName = null; offsetsClipName = null; for (int k = 0; k < links.Count; k++) { lastRelativeRotations[k] = links[k].TargetBindRelative; transitionRotations[k] = (Object.op_Implicit((Object)(object)links[k].Target) ? links[k].Target.localRotation : Quaternion.identity); lastLocalRotations[k] = transitionRotations[k]; } ready = true; Plugin.Log.LogInfo((object)("Sukuna Mixamo animation driver initialized on " + ((Object)this).name + " from '" + animationFileName + "' with " + $"{links.Count} exact body/finger links and " + $"{animationLibrary.Clips.Count} clips " + "(" + (nativeMixamoRig ? "native rig" : "retarget") + ").")); } catch (Exception arg) { ready = false; Plugin.Log.LogError((object)$"Could not initialize Sukuna Mixamo animations: {arg}"); } } private void BorrowLocomotion(AnimationLibrary target) { AnimationLibrary animationLibrary = LoadAnimationLibrary("sukuna.anim"); if (animationLibrary == null || animationLibrary == target) { return; } int[] array = new int[target.BoneNames.Length]; int num = 0; for (int i = 0; i < array.Length; i++) { array[i] = (animationLibrary.BoneIndices.TryGetValue(target.BoneNames[i], out var value) ? value : (-1)); if (array[i] >= 0) { num++; } } string text = (gojoClipSet ? "Lower_" : string.Empty); List list = new List(); string[] borrowedClips = BorrowedClips; foreach (string text2 in borrowedClips) { string text3 = text + text2; if (!target.Clips.ContainsKey(text3) && animationLibrary.Clips.TryGetValue(text2, out var value2)) { AnimationClipData animationClipData = Reindex(value2, target, animationLibrary, array); animationClipData.Name = text3; target.Clips.Add(text3, animationClipData); list.Add(text3); } } if (list.Count > 0) { Plugin.Log.LogInfo((object)("Sukuna set '" + animationFileName + "' borrowed " + string.Join(", ", list) + " from " + string.Format("'{0}' ({1} of ", "sukuna.anim", num) + $"{array.Length} bones matched by name).")); } } private static AnimationClipData Reindex(AnimationClipData clip, AnimationLibrary target, AnimationLibrary source, int[] map) { //IL_0066: 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_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) int num = target.BoneNames.Length; int num2 = source.BoneNames.Length; Quaternion[] array = clip.BindRotations ?? source.BindRotations; AnimationClipData animationClipData = new AnimationClipData { Name = clip.Name, Loop = clip.Loop, Duration = clip.Duration, SampleCount = clip.SampleCount, HipsPositions = clip.HipsPositions, BindHipsPosition = clip.BindHipsPosition, HipsTravel = clip.HipsTravel, HipsSwayFollowed = clip.HipsSwayFollowed, BindRotations = (Quaternion[])(object)new Quaternion[num], Rotations = (Quaternion[])(object)new Quaternion[clip.SampleCount * num] }; for (int i = 0; i < num; i++) { animationClipData.BindRotations[i] = ((map[i] >= 0) ? array[map[i]] : target.BindRotations[i]); } for (int j = 0; j < clip.SampleCount; j++) { int num3 = j * num; int num4 = j * num2; for (int k = 0; k < num; k++) { animationClipData.Rotations[num3 + k] = ((map[k] >= 0) ? clip.Rotations[num4 + map[k]] : animationClipData.BindRotations[k]); } } return animationClipData; } private void EnsureOffsets(AnimationClipData clip) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!string.Equals(offsetsClipName, clip.Name, StringComparison.Ordinal)) { Quaternion[] array = clip.BindRotations ?? cachedLibrary.BindRotations; for (int i = 0; i < links.Count; i++) { BoneLink boneLink = links[i]; rotationOffsets[i] = Quaternion.Inverse(ConvertSourceRotation(array[boneLink.SourceIndex])) * boneLink.TargetBindRelative; } clipHipsBindPosition = ConvertSourcePosition(clip.BindHipsPosition); offsetsClipName = clip.Name; ReportOffsets(clip); } } private void ReportOffsets(AnimationClipData clip) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (firstOffsets == null) { firstOffsets = (Quaternion[])rotationOffsets.Clone(); firstOffsetsClip = clip.Name; } else { if (!reportedOffsets.Add(clip.Name)) { return; } float num = 0f; string text = "none"; for (int i = 0; i < links.Count && i < firstOffsets.Length; i++) { float num2 = Quaternion.Angle(firstOffsets[i], rotationOffsets[i]); if (num2 > num) { num = num2; text = (Object.op_Implicit((Object)(object)links[i].Target) ? ((Object)links[i].Target).name : i.ToString()); } } Plugin.Log.LogInfo((object)("Retarget basis for '" + clip.Name + "' differs from " + $"'{firstOffsetsClip}' by at most {num:0.0} degrees " + "(worst bone " + text + ").")); } } private bool TryResolveLowerClip(GojoCpuPose pose, float phase, out AnimationClipData clip, out float sampleTime) { clip = null; sampleTime = 0f; if (cachedLibrary == null) { return false; } if (!TryTakeClip(pose switch { GojoCpuPose.Sprint => "Run", GojoCpuPose.RunBackward => "RunBackward", _ => "Walk", }, out clip) && !TryTakeClip("Run", out clip) && !TryTakeClip("Walk", out clip)) { return false; } sampleTime = phase * 0.1f; return true; } private bool TryTakeClip(string name, out AnimationClipData clip) { if (!cachedLibrary.Clips.TryGetValue(name, out clip)) { return cachedLibrary.Clips.TryGetValue("Lower_" + name, out clip); } return true; } private void EnsureLowerOffsets(AnimationClipData clip) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!string.Equals(lowerOffsetsClipName, clip.Name, StringComparison.Ordinal)) { Quaternion[] array = clip.BindRotations ?? cachedLibrary.BindRotations; for (int i = 0; i < links.Count; i++) { BoneLink boneLink = links[i]; lowerOffsets[i] = Quaternion.Inverse(ConvertSourceRotation(array[boneLink.SourceIndex])) * boneLink.TargetBindRelative; } lowerClipHipsBindPosition = ConvertSourcePosition(clip.BindHipsPosition); lowerOffsetsClipName = clip.Name; } } internal bool ApplyPose(GojoCpuPose pose, float phase, float strength, int comboStep, float stateDuration, float hitPhase, GojoCpuPose lowerPose = GojoCpuPose.Idle, float lowerPhase = 0f, float lowerStrength = 0f) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: 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_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_07e8: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_07f8: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); if (!ready || !TryResolveClip(pose, phase, strength, comboStep, stateDuration, hitPhase, out var clip, out var sampleTime, out var stretched)) { if (!gojoClipSet && reportedPoses.Add($"refused {pose}")) { ManualLogSource log = Plugin.Log; string[] obj = new string[5] { $"Sukuna pose {pose} REFUSED on {((Object)this).name}: ", $"ready={ready}, links={links.Count}, ", "capturedBind=", null, null }; Quaternion[] array = bindRotations; obj[3] = $"{((array != null) ? array.Length : 0)}, "; obj[4] = "clipResolved=false."; log.LogWarning((object)string.Concat(obj)); } if (nativeMixamoRig && Object.op_Implicit((Object)(object)nativeHips)) { nativeHips.localPosition = nativeHipsBindLocalPosition; } if (lastRelativeRotations != null && !IsUnanswerable(pose) && Time.time - lastAppliedAt < 0.05f) { WriteRelativeRotations(lastRelativeRotations); return true; } return false; } if (reportedPoses.Add($"{pose} {comboStep} {clip.Name}")) { Plugin.Log.LogInfo((object)($"Sukuna pose {pose}/{comboStep} -> clip '{clip.Name}' " + $"at {sampleTime:0.00}s of {clip.Duration:0.00}s " + $"on {((Object)this).name}, phase={phase:0.00}.")); } SampleIndices(clip, sampleTime, out var left, out var right, out var phase2); EnsureOffsets(clip); AnimationClipData clip2 = null; int left2 = 0; int right2 = 0; float phase3 = 0f; float num = 0f; float sampleTime2 = 0f; bool flag = !IsLocomotion(pose) && !OwnsItsLegs(pose) && IsLocomotion(lowerPose) && lowerStrength > 0.08f && TryResolveLowerClip(lowerPose, lowerPhase, out clip2, out sampleTime2) && clip2 != clip; if (flag) { SampleIndices(clip2, sampleTime2, out left2, out right2, out phase3); EnsureLowerOffsets(clip2); num = 1f; } if (reportedPoses.Add($"lower {pose} {flag}")) { Plugin.Log.LogInfo((object)($"Sukuna lower body under {pose} on {((Object)this).name}: " + $"layered={flag}, lowerPose={lowerPose}, " + $"lowerStrength={lowerStrength:0.00}, " + "clip='" + ((clip2 != null) ? clip2.Name : "none") + "'.")); } string text = ((pose == GojoCpuPose.PunchLeft || pose == GojoCpuPose.PunchRight) ? (clip.Name + comboStep) : clip.Name); bool num2 = !clip.Loop && phase < lastStretchPhase - 0.1f; lastStretchPhase = phase; if (num2 || !string.Equals(activeClipName, text, StringComparison.Ordinal)) { bool flag2 = lastLocalRotations != null && Time.time - lastAppliedAt <= 0.05f; for (int i = 0; i < links.Count; i++) { transitionRotations[i] = (flag2 ? lastLocalRotations[i] : (Object.op_Implicit((Object)(object)links[i].Target) ? links[i].Target.localRotation : Quaternion.identity)); } if (reportedPoses.Add("seam " + text)) { Plugin.Log.LogInfo((object)("Sukuna blend into '" + text + "' on " + ((Object)this).name + " starts from " + (flag2 ? "the pose this driver wrote" : "the bone as found") + $"; last applied {Time.time - lastAppliedAt:0.000}s ago.")); } activeClipName = text; transitionStartedAt = Time.time; leavingPose = enteringPose; enteringPose = pose; } bool flag3 = IsAirborne(pose) || IsAirborne(leavingPose); float num3 = (stretched ? 0.03f : (flag3 ? 0.28f : 0.12f)); float num4 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((Time.time - transitionStartedAt) / num3)); Quaternion val = ((pose == GojoCpuPose.Fall) ? MeasureHeadingCorrection(clip, left, right, phase2) : Quaternion.identity); float num5 = (IsLocomotion(pose) ? Mathf.Clamp01(0.25f + strength * 0.75f) : 1f); BoneLink boneLink; int num6; AnimationClipData animationClipData; AnimationClipData animationClipData2; int num7; int num8; float num9; Quaternion val2; float num10; Quaternion val3; Quaternion val4; Quaternion val5; Quaternion val6; Quaternion val7; for (int j = 0; j < links.Count; animationClipData2 = animationClipData, num7 = ((num6 != 0) ? left2 : left), num8 = ((num6 != 0) ? right2 : right), num9 = ((num6 != 0) ? phase3 : phase2), val2 = ((num6 != 0) ? lowerOffsets[j] : rotationOffsets[j]), num10 = ((num6 != 0) ? num : num5), val3 = ConvertSourceRotation(Quaternion.Slerp(animationClipData2.Rotations[num7 * cachedLibrary.BoneNames.Length + boneLink.SourceIndex], animationClipData2.Rotations[num8 * cachedLibrary.BoneNames.Length + boneLink.SourceIndex], num9)) * val2, val4 = val * Quaternion.Slerp(boneLink.TargetBindRelative, val3, num10), val5 = (Object.op_Implicit((Object)(object)boneLink.Target.parent) ? RelativeRotation(boneLink.Target.parent) : Quaternion.identity), val6 = Quaternion.Inverse(val5) * val4, val7 = Quaternion.Slerp(transitionRotations[j], val6, num4), boneLink.Target.localRotation = val7, lastRelativeRotations[j] = val5 * val7, lastLocalRotations[j] = val7, j++) { boneLink = links[j]; if (flag) { num6 = (boneLink.IsLower ? 1 : 0); if (num6 != 0) { animationClipData = clip2; continue; } } else { num6 = 0; } animationClipData = clip; } lastAppliedAt = Time.time; if (num4 >= 1f && reportedPoses.Add($"arms {pose}")) { ReportArm(pose, "mixamorig:LeftArm"); ReportArm(pose, "mixamorig:RightArm"); ReportArm(pose, "mixamorig:LeftForeArm"); ReportArm(pose, "mixamorig:RightForeArm"); } if (nativeMixamoRig && Object.op_Implicit((Object)(object)nativeHips) && !followHips) { nativeHips.localPosition = nativeHipsBindLocalPosition; } else if (nativeMixamoRig && Object.op_Implicit((Object)(object)nativeHips)) { AnimationClipData animationClipData3 = (flag ? clip2 : clip); int num11 = (flag ? left2 : left); int num12 = (flag ? right2 : right); float num13 = (flag ? phase3 : phase2); Vector3 val8 = ConvertSourcePosition(Vector3.Lerp(animationClipData3.HipsPositions[num11], animationClipData3.HipsPositions[num12], num13)); Vector3 val9 = (flag ? lowerClipHipsBindPosition : clipHipsBindPosition); Vector3 val10 = Vector3.forward * (val8.z - val9.z); if (animationClipData3.HipsSwayFollowed) { val10 += HorizontalHipsSway(animationClipData3, val8, val9, Mathf.Lerp((float)num11, (float)num12, num13) / (float)(animationClipData3.SampleCount - 1)); } nativeHips.localPosition = nativeHipsBindLocalPosition + val10; } if (nativeMixamoRig) { ApplyNativeArmDrop(pose); } return true; } private void ApplyNativeArmDrop(GojoCpuPose pose) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) float num = pose switch { GojoCpuPose.Walk => 0.52f, GojoCpuPose.Sprint => 0.45f, GojoCpuPose.RunBackward => 0.45f, GojoCpuPose.Fall => 0.25f, _ => 0f, }; if (!(num <= 0f)) { Vector3 down = -((Component)this).transform.forward; DropArm(nativeLeftArm, nativeLeftForearm, down, num); DropArm(nativeRightArm, nativeRightForearm, down, num); } } private static void DropArm(Transform upperArm, Transform forearm, Vector3 down, float amount) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)upperArm) && Object.op_Implicit((Object)(object)forearm)) { Vector3 val = forearm.position - upperArm.position; if (!(((Vector3)(ref val)).sqrMagnitude < 1E-06f)) { ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Slerp(val, ((Vector3)(ref down)).normalized, Mathf.Clamp01(amount)); Quaternion val3 = Quaternion.FromToRotation(val, val2); upperArm.rotation = val3 * upperArm.rotation; } } } private Quaternion MeasureHeadingCorrection(AnimationClipData clip, int leftSample, int rightSample, float samplePhase) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00c0: Unknown result type (might be due to invalid IL or missing references) if (hipsLinkIndex < 0 || hipsLinkIndex >= links.Count) { return Quaternion.identity; } BoneLink boneLink = links[hipsLinkIndex]; int num = cachedLibrary.BoneNames.Length; Vector3 val = ConvertSourceRotation(Quaternion.Slerp(clip.Rotations[leftSample * num + boneLink.SourceIndex], clip.Rotations[rightSample * num + boneLink.SourceIndex], samplePhase)) * rotationOffsets[hipsLinkIndex] * Vector3.forward; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { return Quaternion.identity; } return Quaternion.AngleAxis(0f - Mathf.Atan2(val2.x, val2.z) * 57.29578f, Vector3.up); } private Quaternion ConvertSourceRotation(Quaternion sourceRotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return sourceBasis * sourceRotation * Quaternion.Inverse(sourceBasis); } private static Vector3 ConvertSourcePosition(Vector3 sourcePosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return new Vector3(sourcePosition.x, 0f - sourcePosition.z, sourcePosition.y); } private bool TryResolveGojoClip(GojoCpuPose pose, float phase, int comboStep, out AnimationClipData clip, out float sampleTime) { clip = null; sampleTime = 0f; string text; switch (pose) { case GojoCpuPose.Jump: case GojoCpuPose.Fall: text = "Fall"; break; case GojoCpuPose.Flight: text = ((!HasShinjukuFlight) ? "Flight" : "FlightShinjuku"); break; case GojoCpuPose.FlightCast: text = "CastStand"; break; case GojoCpuPose.Red: case GojoCpuPose.Blue: text = "CastStand"; break; case GojoCpuPose.Heal: text = "Cast"; break; case GojoCpuPose.Purple: text = "Purple"; break; case GojoCpuPose.Domain: text = "Domain"; break; case GojoCpuPose.PunchLeft: case GojoCpuPose.PunchRight: text = "Punch"; break; case GojoCpuPose.SpinKick: text = "Kick"; break; default: return false; } if (cachedLibrary == null || !cachedLibrary.Clips.TryGetValue(text, out clip)) { clip = null; return false; } switch (pose) { case GojoCpuPose.Domain: sampleTime = Mathf.Min(clip.Duration, Mathf.Clamp01(phase) * 3f); return true; case GojoCpuPose.Jump: case GojoCpuPose.Fall: case GojoCpuPose.Flight: sampleTime = phase; return true; default: { float num = Mathf.Clamp01(phase); if (text == "Punch") { int num2 = Mathf.Clamp(comboStep, 0, 2); float num3 = clip.Duration / 3f; sampleTime = num3 * ((float)num2 + num); } else { sampleTime = clip.Duration * num; } sampleTime = Mathf.Clamp(sampleTime, 0f, clip.Duration); return true; } } } internal bool HasAttackClip(GojoCpuPose pose) { if (cachedLibrary == null || gojoClipSet) { return false; } switch (pose) { case GojoCpuPose.PunchLeft: case GojoCpuPose.PunchRight: return cachedLibrary.Clips.ContainsKey("FistFight"); case GojoCpuPose.SpinKick: return cachedLibrary.Clips.ContainsKey("SpinKick"); default: return false; } } private bool TryResolveClip(GojoCpuPose pose, float phase, float strength, int comboStep, float stateDuration, float hitPhase, out AnimationClipData clip, out float sampleTime, out bool stretched) { //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_0235: Unknown result type (might be due to invalid IL or missing references) clip = null; sampleTime = 0f; stretched = false; if (gojoClipSet) { return TryResolveGojoClip(pose, phase, comboStep, out clip, out sampleTime); } bool flag = false; StrikeWindow? strikeWindow = null; Vector2? val = null; string key; switch (pose) { case GojoCpuPose.Idle: key = ChooseIdleClip("Idle"); break; case GojoCpuPose.Lobby: key = JujutsuConfig.SukunaLobbyClip.Value; if (string.IsNullOrWhiteSpace(key) || !cachedLibrary.Clips.ContainsKey(key)) { key = "Idle"; } key = ChooseIdleClip(key); break; case GojoCpuPose.Walk: key = "Walk"; break; case GojoCpuPose.Sprint: key = "Run"; break; case GojoCpuPose.RunBackward: key = "RunBackward"; break; case GojoCpuPose.Fall: key = "Fall"; break; case GojoCpuPose.PunchLeft: case GojoCpuPose.PunchRight: { key = "FistFight"; StrikeWindow[] array = (todoClipSet ? TodoFistFightStrikes : (yujiClipSet ? YujiFistFightStrikes : SukunaFistFightStrikes)); strikeWindow = array[Mathf.Clamp(comboStep, 0, array.Length - 1)]; break; } case GojoCpuPose.SpinKick: key = "SpinKick"; strikeWindow = (todoClipSet ? TodoSpinKickStrike : (yujiClipSet ? YujiSpinKickStrike : SukunaSpinKickStrike)); break; case GojoCpuPose.Red: case GojoCpuPose.Blue: key = "Slash"; break; case GojoCpuPose.Cast: key = "PiercingBlood"; break; case GojoCpuPose.Domain: key = "Domain"; val = new Vector2(0f, 1.35f); break; case GojoCpuPose.Stomp: key = "Stomp"; strikeWindow = YujiStompStrike; break; case GojoCpuPose.Purple: key = "Fuga"; flag = true; break; default: return false; } if (!cachedLibrary.Clips.TryGetValue(key, out clip)) { return false; } if (strikeWindow.HasValue) { StrikeWindow valueOrDefault = strikeWindow.GetValueOrDefault(); stretched = true; sampleTime = valueOrDefault.Sample(phase, stateDuration, hitPhase); return true; } if (val.HasValue) { Vector2 valueOrDefault2 = val.GetValueOrDefault(); stretched = true; sampleTime = Mathf.Lerp(valueOrDefault2.x, valueOrDefault2.y, Mathf.Clamp01(phase)); return true; } if (flag) { sampleTime = Mathf.Clamp01(phase) * clip.Duration; } else { if (IsLocomotion(pose)) { sampleTime = phase * 0.1f; return true; } if (clip.Name.StartsWith("IdleVariant", StringComparison.Ordinal)) { sampleTime = Time.time - idleVariantStartedAt; return true; } sampleTime = Time.time * pose switch { GojoCpuPose.Lobby => 0.55f, GojoCpuPose.Idle => 0.72f, GojoCpuPose.Fall => 0.85f, _ => 1f, }; } return true; } private static bool IsLocomotion(GojoCpuPose pose) { if (pose != GojoCpuPose.Walk && pose != GojoCpuPose.Sprint) { return pose == GojoCpuPose.RunBackward; } return true; } private static bool OwnsItsLegs(GojoCpuPose pose) { return pose == GojoCpuPose.SpinKick; } private static bool IsLowerBodyBone(string sourceName) { if (!(sourceName == "mixamorig:Hips") && sourceName.IndexOf("UpLeg", StringComparison.Ordinal) < 0 && sourceName.IndexOf("Leg", StringComparison.Ordinal) < 0 && sourceName.IndexOf("Foot", StringComparison.Ordinal) < 0 && sourceName.IndexOf("ToeBase", StringComparison.Ordinal) < 0) { return sourceName.IndexOf("Toe_End", StringComparison.Ordinal) >= 0; } return true; } private static void SampleIndices(AnimationClipData clip, float sampleTime, out int left, out int right, out float phase) { float num = (clip.Loop ? Mathf.Repeat(sampleTime, Mathf.Max(0.001f, clip.Duration)) : Mathf.Clamp(sampleTime, 0f, clip.Duration)) / Mathf.Max(0.001f, clip.Duration) * (float)(clip.SampleCount - 1); left = Mathf.Clamp(Mathf.FloorToInt(num), 0, clip.SampleCount - 1); right = Mathf.Min(left + 1, clip.SampleCount - 1); phase = num - (float)left; } private static AnimationLibrary LoadAnimationLibrary(string fileName) { //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_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_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) if (libraryCache.TryGetValue(fileName, out var value)) { return value; } if (!libraryLoadAttempted.Add(fileName)) { return null; } string text = JujutsuAssetPaths.Find("assets", fileName); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)("Mixamo animation data was not found: " + text)); return null; } using FileStream fileStream = File.OpenRead(text); using BinaryReader binaryReader = new BinaryReader(fileStream); byte[] array = new byte[8] { 83, 75, 65, 78, 73, 77, 48, 49 }; byte[] array2 = binaryReader.ReadBytes(array.Length); if (array2.Length != array.Length) { throw new InvalidDataException("Sukuna animation header is incomplete."); } for (int i = 0; i < array.Length; i++) { if (array2[i] != array[i]) { throw new InvalidDataException("Sukuna animation header is invalid."); } } int num = binaryReader.ReadInt32(); if (num != 1 && num != 2) { throw new InvalidDataException($"Unsupported Sukuna animation version {num}."); } int num2 = ReadSafeCount(binaryReader, 1, 128, "bone"); AnimationLibrary animationLibrary = new AnimationLibrary { BoneNames = new string[num2], BindPositions = (Vector3[])(object)new Vector3[num2], BindRotations = (Quaternion[])(object)new Quaternion[num2] }; for (int j = 0; j < num2; j++) { string text2 = binaryReader.ReadString(); animationLibrary.BoneNames[j] = text2; animationLibrary.BoneIndices.Add(text2, j); animationLibrary.BindPositions[j] = ReadVector3(binaryReader); animationLibrary.BindRotations[j] = ReadQuaternion(binaryReader); } int num3 = ReadSafeCount(binaryReader, 1, 64, "clip"); for (int k = 0; k < num3; k++) { AnimationClipData animationClipData = new AnimationClipData { Name = binaryReader.ReadString(), Loop = binaryReader.ReadBoolean(), Duration = binaryReader.ReadSingle(), SampleCount = ReadSafeCount(binaryReader, 2, 4096, "sample") }; if (!IsFinite(animationClipData.Duration) || animationClipData.Duration <= 0f || animationClipData.Duration > 60f) { throw new InvalidDataException("Animation " + animationClipData.Name + " has an unsafe duration."); } if (num >= 2) { animationClipData.BindHipsPosition = ReadVector3(binaryReader); animationClipData.BindRotations = (Quaternion[])(object)new Quaternion[num2]; for (int l = 0; l < num2; l++) { animationClipData.BindRotations[l] = ReadQuaternion(binaryReader); } } else { animationClipData.BindHipsPosition = animationLibrary.BindPositions[0]; animationClipData.BindRotations = animationLibrary.BindRotations; } animationClipData.HipsPositions = (Vector3[])(object)new Vector3[animationClipData.SampleCount]; animationClipData.Rotations = (Quaternion[])(object)new Quaternion[checked(animationClipData.SampleCount * num2)]; for (int m = 0; m < animationClipData.SampleCount; m++) { animationClipData.HipsPositions[m] = ReadVector3(binaryReader); for (int n = 0; n < num2; n++) { animationClipData.Rotations[m * num2 + n] = ReadQuaternion(binaryReader); } } CorrectStaticHipsYaw(animationClipData, num2); MeasureHipsTravel(animationClipData); animationLibrary.Clips.Add(animationClipData.Name, animationClipData); } if (fileStream.Position != fileStream.Length) { throw new InvalidDataException("Sukuna animation file has unexpected trailing data."); } libraryCache[fileName] = animationLibrary; return animationLibrary; } private static void CorrectStaticHipsYaw(AnimationClipData clip, int boneCount) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00fc: 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_0113: Unknown result type (might be due to invalid IL or missing references) if (boneCount < 1 || clip.SampleCount < 2 || clip.BindRotations == null || clip.BindRotations.Length < 1) { return; } Quaternion val = Quaternion.Inverse(clip.BindRotations[0]); float num = float.MaxValue; float num2 = float.MinValue; float num3 = 0f; for (int i = 0; i < clip.SampleCount; i++) { float num4 = HipsHeading(clip.Rotations[i * boneCount] * val); num = Mathf.Min(num, num4); num2 = Mathf.Max(num2, num4); num3 += num4; } float num5 = num3 / (float)clip.SampleCount; if (num2 - num > 2f || Mathf.Abs(num5) < 8f) { return; } Quaternion val2 = Quaternion.AngleAxis(0f - num5, Vector3.up); for (int j = 0; j < clip.SampleCount; j++) { clip.HipsPositions[j] = val2 * clip.HipsPositions[j]; int num6 = j * boneCount; for (int k = 0; k < boneCount; k++) { clip.Rotations[num6 + k] = val2 * clip.Rotations[num6 + k]; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Sukuna clip " + clip.Name + ": removed a static hips yaw of " + $"{num5:0.##} degrees (heading varied {num2 - num:0.##} " + "degrees across the clip).")); } } private static float HipsHeading(Quaternion delta) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Vector3 val = delta * Vector3.forward; return Mathf.Atan2(val.x, val.z) * 57.29578f; } private static void MeasureHipsTravel(AnimationClipData clip) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ConvertSourcePosition(clip.HipsPositions[0]); Vector3 val2 = ConvertSourcePosition(clip.HipsPositions[clip.SampleCount - 1]); clip.HipsTravel = new Vector3(val2.x - val.x, val2.y - val.y, 0f); Vector3 rest = ConvertSourcePosition(clip.BindHipsPosition); float num = 0f; for (int i = 0; i < clip.SampleCount; i++) { Vector3 val3 = HorizontalHipsSway(clip, ConvertSourcePosition(clip.HipsPositions[i]), rest, (float)i / (float)(clip.SampleCount - 1)); num = Mathf.Max(num, ((Vector3)(ref val3)).magnitude); } clip.HipsSwayFollowed = num <= 0.15f; } private static Vector3 HorizontalHipsSway(AnimationClipData clip, Vector3 sampled, Vector3 rest, float progress) { //IL_0000: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) return new Vector3(sampled.x - rest.x - clip.HipsTravel.x * progress, sampled.y - rest.y - clip.HipsTravel.y * progress, 0f); } private static int ReadSafeCount(BinaryReader reader, int minimum, int maximum, string label) { int num = reader.ReadInt32(); if (num < minimum || num > maximum) { throw new InvalidDataException($"Unsafe Sukuna animation {label} count {num}."); } return num; } private static Vector3 ReadVector3(BinaryReader reader) { //IL_0019: 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_0033: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); if (!IsFinite(val.x) || !IsFinite(val.y) || !IsFinite(val.z)) { throw new InvalidDataException("Sukuna animation contains a non-finite vector."); } return val; } private static Quaternion ReadQuaternion(BinaryReader reader) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) Quaternion val = default(Quaternion); ((Quaternion)(ref val))..ctor(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); if (!IsFinite(val.x) || !IsFinite(val.y) || !IsFinite(val.z) || !IsFinite(val.w)) { throw new InvalidDataException("Sukuna animation contains a non-finite rotation."); } return Quaternion.Normalize(val); } private static bool IsFinite(float value) { if (!float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } } internal sealed class SukunaSettAnimationDriver : MonoBehaviour { private sealed class BoneLink { internal Transform Source; internal Transform Target; internal Quaternion RotationOffset; } private Animator sourceAnimator; private GameObject sourceRig; private string[] targetNames; private Transform[] targetBones; private readonly List links = new List(); private readonly Dictionary avatarBones = new Dictionary(); private BoneLink hipsLink; private Vector3 hipsOffset; private bool initializationAttempted; private bool ready; internal void Configure(string[] names, Transform[] bones) { targetNames = names; targetBones = bones; } internal bool ApplyPose(GojoCpuPose pose, float phase, float strength) { //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); if (!ready) { return false; } AnimationClip clip = GojoHumanoidAnimationLibrary.GetClip(GojoHumanoidAnimationDriver.GetClipName(pose)); if (!Object.op_Implicit((Object)(object)clip)) { return false; } clip.SampleAnimation(((Component)sourceAnimator).gameObject, GojoHumanoidAnimationDriver.GetSampleTime(clip, pose, phase, strength)); for (int i = 0; i < links.Count; i++) { BoneLink boneLink = links[i]; boneLink.Target.rotation = boneLink.Source.rotation * boneLink.RotationOffset; } if (hipsLink != null) { hipsLink.Target.position = hipsLink.Source.position + hipsOffset; } return true; } private void EnsureInitialized() { //IL_00de: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) if (ready || initializationAttempted) { return; } initializationAttempted = true; try { if (targetNames == null || targetBones == null || targetNames.Length == 0 || targetBones.Length == 0) { targetBones = ((Component)this).GetComponentsInChildren(true); targetNames = new string[targetBones.Length]; for (int i = 0; i < targetBones.Length; i++) { targetNames[i] = ((Object)targetBones[i]).name; } } CharacterModel componentInParent = ((Component)this).GetComponentInParent(); GameObject sourcePrefab = GojoHumanoidAnimationLibrary.SourcePrefab; if (!Object.op_Implicit((Object)(object)componentInParent) || !Object.op_Implicit((Object)(object)sourcePrefab)) { throw new InvalidOperationException("Sett animation source is unavailable."); } sourceRig = Object.Instantiate(sourcePrefab, ((Component)componentInParent).transform, false); ((Object)sourceRig).name = "SukunaHiddenSettAnimationRig"; sourceRig.transform.localPosition = Vector3.zero; sourceRig.transform.localRotation = Quaternion.identity; sourceRig.transform.localScale = Vector3.one; Renderer[] componentsInChildren = sourceRig.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].enabled = false; } Collider[] componentsInChildren2 = sourceRig.GetComponentsInChildren(true); for (int k = 0; k < componentsInChildren2.Length; k++) { componentsInChildren2[k].enabled = false; } sourceAnimator = sourceRig.GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)sourceAnimator) || !Object.op_Implicit((Object)(object)sourceAnimator.avatar) || !sourceAnimator.avatar.isValid || !sourceAnimator.avatar.isHuman) { throw new InvalidOperationException("Sett animation source has no humanoid Avatar."); } sourceAnimator.applyRootMotion = false; sourceAnimator.runtimeAnimatorController = null; ((Behaviour)sourceAnimator).enabled = true; sourceAnimator.Rebind(); sourceAnimator.Update(0f); BuildAvatarBoneMap(); Dictionary dictionary = new Dictionary(StringComparer.Ordinal); string[] array = targetNames; int num = ((array != null) ? array.Length : 0); Transform[] array2 = targetBones; int num2 = Mathf.Min(num, (array2 != null) ? array2.Length : 0); for (int l = 0; l < num2; l++) { if (Object.op_Implicit((Object)(object)targetBones[l])) { dictionary[targetNames[l]] = targetBones[l]; } } AddLink(dictionary, "root.x", (HumanBodyBones)0, hips: true, (HumanBodyBones)55); AddLink(dictionary, "spine_str_cns_01.x", (HumanBodyBones)7, hips: false, (HumanBodyBones)55); AddLink(dictionary, "spine_str_cns_02.x", (HumanBodyBones)8, hips: false, (HumanBodyBones)55); AddLink(dictionary, "spine_str_cns_03.x", (HumanBodyBones)54, hips: false, (HumanBodyBones)8); AddLink(dictionary, "neck.x", (HumanBodyBones)9, hips: false, (HumanBodyBones)55); AddLink(dictionary, "head.x", (HumanBodyBones)10, hips: false, (HumanBodyBones)55); AddSide(dictionary, ".l", left: true); AddSide(dictionary, ".r", left: false); if (links.Count < 18 || hipsLink == null) { throw new InvalidOperationException($"Only {links.Count} Sett-to-Sukuna bone links were resolved."); } for (int m = 0; m < links.Count; m++) { BoneLink boneLink = links[m]; boneLink.RotationOffset = Quaternion.Inverse(boneLink.Source.rotation) * boneLink.Target.rotation; } hipsOffset = hipsLink.Target.position - hipsLink.Source.position; ((Behaviour)sourceAnimator).enabled = false; ready = true; Plugin.Log.LogInfo((object)("Sukuna exact Sett animation driver initialized with " + $"{links.Count} body links.")); } catch (Exception arg) { Plugin.Log.LogError((object)$"Could not initialize Sukuna Sett animations: {arg}"); if (Object.op_Implicit((Object)(object)sourceRig)) { Object.Destroy((Object)(object)sourceRig); } } } private void AddSide(Dictionary targets, string suffix, bool left) { AddLink(targets, "shoulder" + suffix, (HumanBodyBones)(left ? 11 : 12), hips: false, (HumanBodyBones)55); AddLink(targets, "arm_stretch" + suffix, (HumanBodyBones)(left ? 13 : 14), hips: false, (HumanBodyBones)55); AddLink(targets, "forearm_stretch" + suffix, (HumanBodyBones)(left ? 15 : 16), hips: false, (HumanBodyBones)55); AddLink(targets, "hand" + suffix, (HumanBodyBones)(left ? 17 : 18), hips: false, (HumanBodyBones)55); AddLink(targets, "thigh_stretch" + suffix, (HumanBodyBones)(left ? 1 : 2), hips: false, (HumanBodyBones)55); AddLink(targets, "leg_stretch" + suffix, (HumanBodyBones)(left ? 3 : 4), hips: false, (HumanBodyBones)55); AddLink(targets, "foot" + suffix, (HumanBodyBones)(left ? 5 : 6), hips: false, (HumanBodyBones)55); AddLink(targets, "toes_01" + suffix, (HumanBodyBones)(left ? 19 : 20), hips: false, (HumanBodyBones)55); } private void AddLink(Dictionary targets, string targetName, HumanBodyBones sourceBone, bool hips = false, HumanBodyBones fallback = (HumanBodyBones)55) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!targets.TryGetValue(targetName, out var value)) { return; } Transform sourceBone2 = GetSourceBone(sourceBone); if (!Object.op_Implicit((Object)(object)sourceBone2) && (int)fallback != 55) { sourceBone2 = GetSourceBone(fallback); } if (Object.op_Implicit((Object)(object)sourceBone2)) { BoneLink item = new BoneLink { Source = sourceBone2, Target = value }; links.Add(item); if (hips) { hipsLink = item; } } } private Transform GetSourceBone(HumanBodyBones bone) { //IL_0006: 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_0021: Unknown result type (might be due to invalid IL or missing references) if (avatarBones.TryGetValue(bone, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } try { Transform boneTransform = sourceAnimator.GetBoneTransform(bone); if (Object.op_Implicit((Object)(object)boneTransform)) { return boneTransform; } } catch { } string[] aliases = GetAliases(bone); Transform[] componentsInChildren = sourceRig.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { string text = NormalizeBoneName(((Object)componentsInChildren[i]).name); for (int j = 0; j < aliases.Length; j++) { string text2 = NormalizeBoneName(aliases[j]); if (text == text2 || text.EndsWith(text2, StringComparison.Ordinal)) { return componentsInChildren[i]; } } } return null; } private void BuildAvatarBoneMap() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) avatarBones.Clear(); Dictionary dictionary = new Dictionary(StringComparer.Ordinal); Transform[] componentsInChildren = sourceRig.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && !dictionary.ContainsKey(((Object)componentsInChildren[i]).name)) { dictionary.Add(((Object)componentsInChildren[i]).name, componentsInChildren[i]); } } HumanBone[] human = sourceAnimator.avatar.humanDescription.human; for (int j = 0; j < human.Length; j++) { HumanBone val = human[j]; int num = Array.IndexOf(HumanTrait.BoneName, ((HumanBone)(ref val)).humanName); if (num >= 0 && num < 55 && dictionary.TryGetValue(((HumanBone)(ref val)).boneName, out var value) && Object.op_Implicit((Object)(object)value)) { avatarBones[(HumanBodyBones)num] = value; } } Plugin.Log.LogInfo((object)("Sett Avatar description resolved " + $"{avatarBones.Count} humanoid source bones from " + $"{componentsInChildren.Length} transforms.")); } private static string[] GetAliases(HumanBodyBones bone) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected I4, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 switch ((int)bone) { default: if ((int)bone == 54) { return new string[3] { "UpperChest", "Chest", "Spine3" }; } return Array.Empty(); case 0: return new string[3] { "Pelvis", "Hips", "Hip" }; case 7: return new string[2] { "Spine", "Spine1" }; case 8: return new string[2] { "Chest", "Spine2" }; case 9: return new string[1] { "Neck" }; case 10: return new string[1] { "Head" }; case 11: return new string[3] { "LeftShoulder", "ShoulderL", "LShoulder" }; case 12: return new string[3] { "RightShoulder", "ShoulderR", "RShoulder" }; case 13: return new string[3] { "LeftUpperArm", "UpperArmL", "ArmL" }; case 14: return new string[3] { "RightUpperArm", "UpperArmR", "ArmR" }; case 15: return new string[3] { "LeftLowerArm", "LowerArmL", "ForearmL" }; case 16: return new string[3] { "RightLowerArm", "LowerArmR", "ForearmR" }; case 17: return new string[2] { "LeftHand", "HandL" }; case 18: return new string[2] { "RightHand", "HandR" }; case 1: return new string[3] { "LeftUpperLeg", "UpperLegL", "ThighL" }; case 2: return new string[3] { "RightUpperLeg", "UpperLegR", "ThighR" }; case 3: return new string[3] { "LeftLowerLeg", "LowerLegL", "CalfL" }; case 4: return new string[3] { "RightLowerLeg", "LowerLegR", "CalfR" }; case 5: return new string[2] { "LeftFoot", "FootL" }; case 6: return new string[2] { "RightFoot", "FootR" }; case 19: return new string[3] { "LeftToes", "ToeL", "ToesL" }; case 20: return new string[3] { "RightToes", "ToeR", "ToesR" }; } } private static string NormalizeBoneName(string value) { if (string.IsNullOrEmpty(value)) { return string.Empty; } char[] array = new char[value.Length]; int length = 0; foreach (char c in value) { if (char.IsLetterOrDigit(c)) { array[length++] = char.ToLowerInvariant(c); } } return new string(array, 0, length); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)sourceRig)) { Object.Destroy((Object)(object)sourceRig); } } } internal static class SukunaVisuals { private static bool slashVisualFailureLogged; private static bool flyingSlashVisualFailureLogged; internal static readonly Color DarkSlash = new Color(0.035f, 0.04f, 0.055f, 0.96f); internal static readonly Color GreySlash = new Color(0.34f, 0.37f, 0.43f, 0.9f); internal static RuntimeSlashVisual CreateSlash(Vector3 start, Vector3 end, float width, float lifetime, Color color, bool withLight = true) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_0016: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SukunaDismantleSlash"); try { RuntimeSlashVisual runtimeSlashVisual = val.AddComponent(); runtimeSlashVisual.Initialize(start, end, width, lifetime, color, withLight); return runtimeSlashVisual; } catch (Exception arg) { Object.Destroy((Object)(object)val); if (!slashVisualFailureLogged) { slashVisualFailureLogged = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Sukuna slash visual failed and was disabled; " + $"gameplay will continue: {arg}")); } } return null; } } internal static RuntimeSlashVisual CreateHeldSlash(Vector3 start, Vector3 end, float width, float fade, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_0016: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("JujutsuHeldSlash"); try { RuntimeSlashVisual runtimeSlashVisual = val.AddComponent(); runtimeSlashVisual.Initialize(start, end, width, fade, color, withLight: false, layered: false); runtimeSlashVisual.HoldFor(float.MaxValue); return runtimeSlashVisual; } catch (Exception arg) { Object.Destroy((Object)(object)val); if (!slashVisualFailureLogged) { slashVisualFailureLogged = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Held slash visual failed and was disabled; " + $"gameplay will continue: {arg}")); } } return null; } } internal static RuntimeFlyingSlashVisual CreateFlyingSlash(Vector3 start, Vector3 direction, float speed, float lifetime, float length, float width, float rollDegrees, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SukunaFlyingSlash"); try { RuntimeFlyingSlashVisual runtimeFlyingSlashVisual = val.AddComponent(); runtimeFlyingSlashVisual.Initialize(start, direction, speed, lifetime, length, width, rollDegrees, color); return runtimeFlyingSlashVisual; } catch (Exception arg) { Object.Destroy((Object)(object)val); if (!flyingSlashVisualFailureLogged) { flyingSlashVisualFailureLogged = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Sukuna flying-slash visual failed and was disabled; " + $"gameplay will continue: {arg}")); } } return null; } } internal static void CreateCross(Vector3 center, Vector3 right, Vector3 up, float radius, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0079: Unknown result type (might be due to invalid IL or missing references) Vector3 val = right + up * 0.72f; Vector3 val2 = ((Vector3)(ref val)).normalized * radius; val = right - up * 0.72f; Vector3 val3 = ((Vector3)(ref val)).normalized * radius; CreateSlash(center - val2, center + val2, 0.3f, 0.24f, color); CreateSlash(center - val3, center + val3, 0.3f, 0.24f, color); } internal static Material CreateSafeMaterial(string name, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) Material obj = JujutsuFxMaterials.CreateSurfaceMaterial(name, color); SetColor(obj, "_EmColor", color * 2f); return obj; } internal static void SetColor(Material material, string property, Color color) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)material) && material.HasProperty(property)) { material.SetColor(property, color); } } internal static void ConfigureTransparent(Material material) { JujutsuFxMaterials.ConfigureTransparent(material); } } internal sealed class RuntimeSlashVisual : MonoBehaviour { private LineRenderer line; private LineRenderer coreLine; private LineRenderer bleedLine; private Material bleedMaterial; private Color bleedColor; private Material material; private Material coreMaterial; private Color color; private float initialWidth; private float lifetime; private float hold; private float widthScale = 1f; private float age; internal void SetWidthScale(float scale) { widthScale = Mathf.Max(0.05f, scale); } internal void SetEnds(Vector3 start, Vector3 end) { //IL_0014: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)line)) { line.SetPosition(0, start); line.SetPosition(1, end); } if (Object.op_Implicit((Object)(object)coreLine)) { coreLine.SetPosition(0, Vector3.Lerp(start, end, 0.01f)); coreLine.SetPosition(1, Vector3.Lerp(start, end, 0.99f)); } } internal void HoldFor(float seconds) { hold = Mathf.Max(0f, seconds); } internal void Release() { hold = 0f; age = 0f; } internal void Initialize(Vector3 start, Vector3 end, float width, float duration, Color tint, bool withLight = true, bool layered = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_014c: 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) color = tint; initialWidth = Mathf.Max(0.03f, width); lifetime = Mathf.Max(0.05f, duration); line = ((Component)this).gameObject.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)line); line.useWorldSpace = true; line.positionCount = 2; line.SetPosition(0, start); line.SetPosition(1, end); line.widthMultiplier = initialWidth; line.numCapVertices = 4; line.numCornerVertices = 2; line.startColor = color; line.endColor = color; material = JujutsuFxMaterials.CreateLineMaterial("matSukunaSlash", color); ((Renderer)line).material = material; if (layered) { BuildLayers(start, end); } if (withLight) { float num = Vector3.Distance(start, end); Light val = JujutsuFxLights.TryAddMinor(((Component)this).gameObject, color, 2.2f, Mathf.Min(16f, Mathf.Max(3f, num * 0.3f)), num); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).transform.position = (start + end) * 0.5f; } } } private void BuildLayers(Vector3 start, Vector3 end) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SukunaSlashCore"); val.transform.SetParent(((Component)this).transform, false); coreLine = val.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)coreLine); coreLine.useWorldSpace = true; coreLine.positionCount = 2; coreLine.SetPosition(0, start); coreLine.SetPosition(1, end); coreLine.widthMultiplier = initialWidth * 0.24f; coreLine.numCapVertices = 4; coreLine.numCornerVertices = 2; Color val2 = Color.Lerp(color, Color.white, 0.94f); val2.a = 1f; coreLine.startColor = val2; coreLine.endColor = val2; coreMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaSlashCore", val2); ((Renderer)coreLine).material = coreMaterial; GameObject val3 = new GameObject("SukunaSlashBleed"); val3.transform.SetParent(((Component)this).transform, false); bleedLine = val3.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)bleedLine); bleedLine.useWorldSpace = true; bleedLine.positionCount = 2; bleedLine.SetPosition(0, start); bleedLine.SetPosition(1, end); bleedLine.widthMultiplier = initialWidth * 1.5f; bleedLine.numCapVertices = 4; bleedColor = new Color(0.55f, 0.03f, 0.05f, 0.5f); bleedLine.startColor = bleedColor; bleedLine.endColor = bleedColor; bleedMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaSlashBleed", bleedColor); ((Renderer)bleedLine).material = bleedMaterial; } private void Update() { //IL_003f: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float num = Mathf.Clamp01(Mathf.Max(0f, age - hold) / lifetime); float num2 = 1f - num; Color val = color; val.a *= num2; if (Object.op_Implicit((Object)(object)line)) { line.widthMultiplier = initialWidth * widthScale * Mathf.Lerp(1f, 0.55f, num); line.startColor = val; line.endColor = val; } if (Object.op_Implicit((Object)(object)coreLine)) { float a = 1f - Mathf.Clamp01(num / 0.3f); Color val2 = Color.Lerp(color, Color.white, 0.94f); val2.a = a; coreLine.widthMultiplier = initialWidth * 0.22f * widthScale * Mathf.Lerp(1f, 0.4f, num); coreLine.startColor = val2; coreLine.endColor = val2; JujutsuFxMaterials.SetTint(coreMaterial, val2, 1.5f); } if (Object.op_Implicit((Object)(object)bleedLine)) { Color val3 = bleedColor; val3.a = bleedColor.a * Mathf.Sin(num * MathF.PI); bleedLine.widthMultiplier = initialWidth * 1.5f * widthScale * Mathf.Lerp(0.7f, 1.35f, num); bleedLine.startColor = val3; bleedLine.endColor = val3; JujutsuFxMaterials.SetTint(bleedMaterial, val3, 1.5f); } JujutsuFxMaterials.SetTint(material, val, 1.5f); if (num >= 1f && age > hold) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)bleedMaterial)) { Object.Destroy((Object)(object)bleedMaterial); } if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } if (Object.op_Implicit((Object)(object)coreMaterial)) { Object.Destroy((Object)(object)coreMaterial); } } } internal sealed class RuntimeFlyingSlashVisual : MonoBehaviour { private LineRenderer line; private LineRenderer coreLine; private Material material; private Material coreMaterial; private Vector3 center; private Vector3 direction; private Vector3 slashAxis; private Color color; private float speed; private float lifetime; private float halfLength; private float initialWidth; private float age; internal void Initialize(Vector3 start, Vector3 travelDirection, float travelSpeed, float duration, float length, float width, float rollDegrees, Color tint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0024: 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_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) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) center = start; direction = ((((Vector3)(ref travelDirection)).sqrMagnitude > 0.001f) ? ((Vector3)(ref travelDirection)).normalized : Vector3.forward); speed = Mathf.Max(1f, travelSpeed); lifetime = Mathf.Max(0.05f, duration); halfLength = Mathf.Max(0.25f, length * 0.5f); initialWidth = Mathf.Max(0.03f, width); color = tint; Vector3 val = Vector3.Cross(Vector3.up, direction); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.right; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(direction, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = rollDegrees * (MathF.PI / 180f); val2 = val * Mathf.Cos(num) + normalized * Mathf.Sin(num); slashAxis = ((Vector3)(ref val2)).normalized; line = ((Component)this).gameObject.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)line); line.useWorldSpace = true; line.positionCount = 2; line.widthMultiplier = initialWidth; line.numCapVertices = 4; line.startColor = color; line.endColor = color; material = JujutsuFxMaterials.CreateLineMaterial("matSukunaFlyingSlash", color); ((Renderer)line).material = material; GameObject val3 = new GameObject("SukunaFlyingSlashCore"); val3.transform.SetParent(((Component)this).transform, false); coreLine = val3.AddComponent(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)coreLine); coreLine.useWorldSpace = true; coreLine.positionCount = 2; coreLine.widthMultiplier = initialWidth * 0.26f; coreLine.numCapVertices = 4; Color val4 = Color.Lerp(color, Color.white, 0.94f); val4.a = 1f; coreLine.startColor = val4; coreLine.endColor = val4; coreMaterial = JujutsuFxMaterials.CreateLineMaterial("matSukunaFlyingSlashCore", val4); ((Renderer)coreLine).material = coreMaterial; UpdateLine(); } private void Update() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; age += deltaTime; center += direction * speed * deltaTime; float num = Mathf.Clamp01(age / lifetime); float num2 = 1f - num; Color val = color; val.a *= num2; if (Object.op_Implicit((Object)(object)line)) { line.widthMultiplier = initialWidth * Mathf.Lerp(1f, 0.12f, num); line.startColor = val; line.endColor = val; UpdateLine(); } if (Object.op_Implicit((Object)(object)coreLine)) { Color val2 = Color.Lerp(color, Color.white, 0.64f); val2.a = num2 * 0.9f; coreLine.widthMultiplier = initialWidth * 0.26f * Mathf.Lerp(1f, 0.04f, num); coreLine.startColor = val2; coreLine.endColor = val2; JujutsuFxMaterials.SetTint(coreMaterial, val2, 1.5f); } JujutsuFxMaterials.SetTint(material, val, 1.5f); if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void UpdateLine() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0084: 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_00a5: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)line)) { line.SetPosition(0, center - slashAxis * halfLength); line.SetPosition(1, center + slashAxis * halfLength); if (Object.op_Implicit((Object)(object)coreLine)) { coreLine.SetPosition(0, center - slashAxis * halfLength * 0.98f); coreLine.SetPosition(1, center + slashAxis * halfLength * 0.98f); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } if (Object.op_Implicit((Object)(object)coreMaterial)) { Object.Destroy((Object)(object)coreMaterial); } } } public static class TextureAudit { private const float ReportDelaySeconds = 40f; private static readonly HashSet SkinsSeen = new HashSet(); private static readonly Dictionary> Requested = new Dictionary>(); private static readonly Dictionary> Missing = new Dictionary>(); private static bool reported; [ConCommand(commandName = "jujutsu_textures", helpText = "jujutsu_textures - lists the shipped texture files nothing has asked for this session.")] public static void CcJujutsuTextures(ConCommandArgs args) { reported = false; Report(); } internal static void NoteSkin(string description) { if (!string.IsNullOrEmpty(description)) { SkinsSeen.Add(description); } } internal static void Record(string directory, string fileName, bool found) { if (!string.IsNullOrEmpty(directory) && !string.IsNullOrEmpty(fileName)) { Add(Requested, directory, fileName); if (!found) { Add(Missing, directory, fileName); } } } private static void Add(Dictionary> into, string directory, string fileName) { if (!into.TryGetValue(directory, out var value)) { value = (into[directory] = new HashSet(StringComparer.OrdinalIgnoreCase)); } value.Add(Path.GetFileName(fileName)); } internal static IEnumerator ReportAfterDelay() { yield return (object)new WaitForSeconds(40f); Report(); } internal static void Report() { if (reported) { return; } reported = true; if (Requested.Count == 0) { Plugin.Log.LogInfo((object)"Texture audit: no model requested a texture, so nothing can be said about which files are unused."); return; } Plugin.Log.LogInfo((object)("Texture audit after " + StatTextSeconds() + " seconds, " + $"{Requested.Count} folder(s) reporting. Anything listed as " + "unused is only unused for the characters and skins this session actually loaded.")); long num = 0L; foreach (KeyValuePair> item in Requested) { string key = item.Key; string text = JujutsuAssetPaths.Find("assets", key); if (!Directory.Exists(text)) { Plugin.Log.LogWarning((object)(" " + key + ": folder is missing at " + text + ".")); continue; } if (Missing.TryGetValue(key, out var value) && value.Count > 0) { Plugin.Log.LogWarning((object)($" {key}: {value.Count} texture(s) asked for " + "and not on disk: " + string.Join(", ", value))); } long num2 = 0L; int num3 = 0; string[] files = Directory.GetFiles(text, "*.png"); foreach (string text2 in files) { string fileName = Path.GetFileName(text2); if (!item.Value.Contains(fileName)) { num3++; long length = new FileInfo(text2).Length; num2 += length; Plugin.Log.LogInfo((object)$" unused {(float)length / 1024f / 1024f:0.00} MB {fileName}"); } } num += num2; Plugin.Log.LogInfo((object)($" {key}: {item.Value.Count} requested, " + $"{num3} never requested, " + $"{(float)num2 / 1024f / 1024f:0.00} MB idle.")); } Plugin.Log.LogInfo((object)($"Texture audit total: {(float)num / 1024f / 1024f:0.00} MB " + "never requested this session.")); Plugin.Log.LogInfo((object)((SkinsSeen.Count == 0) ? " No outfit was applied, so every 'unused' line above is meaningless — nothing had a skin to load textures for." : ($" Outfits worn this session ({SkinsSeen.Count}): " + string.Join(", ", SkinsSeen) + ". Anything not in that list still has its textures counted as unused, so cycle every skin on every character before deleting on this."))); } private static string StatTextSeconds() { return 40f.ToString("0.##", CultureInfo.InvariantCulture); } } } namespace GojoSatoruMod.States { public sealed class DomainExpansionState : BaseSkillState { private Vector3 lockedFacing; private const float ActivateAt = 3f; internal const float CastDuration = 3f; private int closedShells; private bool activated; private bool gravitySuspended; private GojoFaceCamera faceCamera; internal float AnimationPhase => Mathf.Clamp01(((EntityState)this).fixedAge / 3f); public override void OnEnter() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(3.5f); Vector3 val; Vector3 normalized; if (!Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { val = Vector3.ProjectOnPlane(((EntityState)this).characterBody.transform.forward, Vector3.up); normalized = ((Vector3)(ref val)).normalized; } else { val = Vector3.ProjectOnPlane(((EntityState)this).characterDirection.forward, Vector3.up); normalized = ((Vector3)(ref val)).normalized; } lockedFacing = normalized; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).characterMotor.useGravity) { gravitySuspended = true; ((EntityState)this).characterMotor.useGravity = false; } LockMovement(); if (((EntityState)this).isAuthority) { faceCamera = GojoFaceCamera.Push(((EntityState)this).characterBody); } RootedArmorController.Find(((EntityState)this).characterBody)?.Push(); if (GojoAssets.DomainSound != null) { GojoAssets.PlayAttackSound(GojoAssets.DomainSound, ((EntityState)this).characterBody.corePosition, 1f); } else { Util.PlaySound("Play_voidRaid_snipe_shoot_final", ((EntityState)this).gameObject); } if (GojoStateUtils.HasAnimatorLayer(((EntityState)this).GetModelAnimator(), "FullBody, Override")) { ((EntityState)this).PlayAnimation("FullBody, Override", "Cast1"); } } public override void FixedUpdate() { //IL_004d: 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_0068: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); LockMovement(); if (!activated) { UpdateClosingBarrier(); } if (!activated && ((EntityState)this).fixedAge >= 3f) { activated = true; ((Component)((EntityState)this).characterBody).GetComponent()?.Activate(((EntityState)this).characterBody.corePosition, ((BaseState)this).damageStat); DomainBarrierVisual.SpawnSeal(((EntityState)this).characterBody.corePosition, GojoAssets.DomainGlow, 32f, GojoTechniqueStyle.Purple); } if (((EntityState)this).fixedAge >= 3f && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void UpdateClosingBarrier() { //IL_0025: 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_0034: Unknown result type (might be due to invalid IL or missing references) if (closedShells < 7 && !(((EntityState)this).fixedAge < 0.4f * (float)closedShells)) { DomainBarrierVisual.SpawnClosingShell(((EntityState)this).characterBody.corePosition, (closedShells % 2 == 0) ? GojoAssets.DomainGlow : GojoAssets.DomainStar, 32f, closedShells, GojoTechniqueStyle.Purple); closedShells++; } } private void LockMovement() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; ((EntityState)this).characterMotor.rootMotion = Vector3.zero; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && ((Vector3)(ref lockedFacing)).sqrMagnitude > 0.01f) { ((EntityState)this).characterDirection.moveVector = lockedFacing; ((EntityState)this).characterDirection.forward = lockedFacing; } } } public override void OnExit() { if (gravitySuspended) { gravitySuspended = false; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.useGravity = true; } } if (faceCamera != null) { faceCamera.Release(); faceCamera = null; } RootedArmorController.Find(((EntityState)this).characterBody)?.Pop(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } internal static class GojoDamageUtility { private static Collider[] overlapBuffer = (Collider[])(object)new Collider[256]; private static bool reportedGrowth; private static bool reportedUnresolved; private static bool reportedRejection; private static readonly HashSet reportedSilent = new HashSet(); internal const float KnockbackScale = 0.5f; private static bool reportedEliteHit; private static bool reportedFirstHit; internal static Collider[] OverlapEnemies(Vector3 center, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); } internal static int OverlapEnemiesNonAlloc(Vector3 center, float radius, out Collider[] colliders) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) int num; while (true) { num = Physics.OverlapSphereNonAlloc(center, radius, overlapBuffer, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); if (num < overlapBuffer.Length || overlapBuffer.Length >= 4096) { break; } overlapBuffer = (Collider[])(object)new Collider[overlapBuffer.Length * 2]; if (!reportedGrowth) { reportedGrowth = true; Plugin.Log.LogInfo((object)("Overlap buffer grew to " + overlapBuffer.Length + " colliders; a field scan filled it, so the old size would have dropped victims. Reported once.")); } } if (num >= overlapBuffer.Length) { Plugin.Log.LogWarning((object)($"Overlap scan at {center} radius {radius:0.#} hit the " + $"{overlapBuffer.Length} collider ceiling; anything past " + "that was not counted.")); } colliders = overlapBuffer; return num; } internal static Collider[] OverlapEnemiesBetween(Vector3 start, Vector3 end, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return Physics.OverlapCapsule(start, end, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); } internal static bool TouchesEnemy(TeamIndex ownerTeam, Vector3 start, Vector3 end, float radius, out Vector3 contact) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) contact = end; Collider[] array = Physics.OverlapCapsule(start, end, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); if (array.Length == 0) { return false; } HashSet victims = new HashSet(); float num = float.MaxValue; bool flag = false; for (int i = 0; i < array.Length; i++) { HealthComponent val = FindEnemyHealth(array[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.body)) { Vector3 corePosition = val.body.corePosition; Vector3 val2 = corePosition - start; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; contact = corePosition; flag = true; } } } if (!flag && !reportedUnresolved) { reportedUnresolved = true; Plugin.Log.LogWarning((object)($"Sphere contact found {array.Length} collider(s) on " + "the hurtbox layer and none of them resolved to a live enemy. First was '" + DescribeCollider(array[0]) + "'.")); } return flag; } internal static void ReportSilentPass(string label, int colliderCount, int applied, float damage, Vector3 center) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((applied <= 0 || !(damage > 0f)) && reportedSilent.Add(label)) { Plugin.Log.LogWarning((object)($"{label} dealt nothing at {center}: {colliderCount} " + $"collider(s) on the hurtbox layer, {applied} of them a live " + $"enemy, damage {damage:0.00}.")); } } private static string DescribeCollider(Collider collider) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)collider)) { return ""; } HurtBox componentInParent = ((Component)collider).GetComponentInParent(); HealthComponent val = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.healthComponent : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.body : null); return ((Object)collider).name + ", hurtBox=" + (Object.op_Implicit((Object)(object)componentInParent) ? "yes" : "no") + ", health=" + (Object.op_Implicit((Object)(object)val) ? "yes" : "no") + ", body=" + (Object.op_Implicit((Object)(object)val2) ? ((Object)val2).name : "none") + ", " + $"alive={Object.op_Implicit((Object)(object)val) && val.alive}, " + "team=" + ((Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.teamComponent)) ? ((object)val2.teamComponent.teamIndex/*cast due to .constrained prefix*/).ToString() : "none"); } internal static HealthComponent FindEnemyHealth(Collider collider, TeamIndex ownerTeam, HashSet victims) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) HurtBox val = (Object.op_Implicit((Object)(object)collider) ? ((Component)collider).GetComponentInParent() : null); HealthComponent val2 = (Object.op_Implicit((Object)(object)val) ? val.healthComponent : null); CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.body : null); if (!Object.op_Implicit((Object)(object)val2) || !val2.alive || !Object.op_Implicit((Object)(object)val3) || victims.Contains(val2)) { return null; } if (Object.op_Implicit((Object)(object)val3.teamComponent) && val3.teamComponent.teamIndex == ownerTeam) { return null; } victims.Add(val2); return val2; } internal static Vector3 Knockback(Vector3 force) { //IL_0000: 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) return force * 0.5f; } internal static float Knockback(float force) { return force * 0.5f; } internal static void ApplyDamage(GameObject attacker, HealthComponent health, float damage, Vector3 force, bool crit, float procCoefficient, DamageTypeCombo damageType, DamageColorIndex damageColorIndex) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)health) || !Object.op_Implicit((Object)(object)health.body)) { return; } DamageInfo val = new DamageInfo { attacker = attacker, inflictor = attacker, position = health.body.corePosition, damage = damage, force = Knockback(force), crit = crit, procCoefficient = procCoefficient, damageColorIndex = damageColorIndex, damageType = damageType }; health.TakeDamage(val); if (val.rejected) { if (!reportedRejection) { reportedRejection = true; Plugin.Log.LogInfo((object)("A hit on " + health.body.GetDisplayName() + " was rejected by the victim, so no on-hit effects were run for it. Reported once.")); } return; } GlobalEventManager instance = GlobalEventManager.instance; if (Object.op_Implicit((Object)(object)instance)) { instance.OnHitEnemy(val, ((Component)health).gameObject); instance.OnHitAll(val, ((Component)health).gameObject); ReportEliteHit(attacker, val); } } private static void ReportEliteHit(GameObject attacker, DamageInfo damageInfo) { CharacterBody component = attacker.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { if (!reportedFirstHit) { reportedFirstHit = true; Plugin.Log.LogInfo((object)("First hit of the session went through the on-hit events " + $"with a proc coefficient of {damageInfo.procCoefficient}; " + "the attacker " + (component.isElite ? "is" : "is not") + " carrying an elite aspect. Reported once.")); } if (!reportedEliteHit && component.isElite) { reportedEliteHit = true; Plugin.Log.LogInfo((object)(component.GetDisplayName() + " is carrying an elite aspect and landed a hit through OnHitEnemy with a proc coefficient of " + $"{damageInfo.procCoefficient}, which is what applies that " + "aspect's own on-hit effect. Reported once.")); } } } } public sealed class GojoDashState : BaseSkillState { internal const float FreeDashDistance = 19f; private const float FreeDashSpeed = 76f; private const float FreeDashDuration = 0.25f; private const float FreeDashExitFraction = 0.5f; internal const float SearchRange = 34f; private const float SearchAngle = 24f; private const float BackGap = 2.6f; internal const float BlastRadius = 7.5f; internal const float BlastDamage = 16f; private const float Recovery = 0.18f; private const float LaunchSpeed = 32f; private const float LaunchLift = 0.4f; private const float MinimumLaunchMass = 60f; private const float MaximumLaunchMass = 1600f; internal const float ExecuteHealthFraction = 0.25f; private readonly HashSet victims = new HashSet(); private CharacterBody target; private bool detonated; private Vector3 travelDirection; private bool dashing; private bool gravityDisabled; private readonly JujutsuCloseDash closing = new JujutsuCloseDash(); private bool crossing; private float arrivedAt; private Vector3 behindOffset; private bool HasLivingTarget { get { if (Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.healthComponent)) { return target.healthComponent.alive; } return false; } } public override void OnEnter() { //IL_0009: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); target = FindAimedTarget(((BaseState)this).GetAimRay()); if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.SetAimTimer(0.43f); } Vector3 val = (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position); if (HasLivingTarget && ((EntityState)this).isAuthority) { BeginClosing(); } else if (HasLivingTarget) { FaceTarget(); Detonate(); } else if (((EntityState)this).isAuthority) { BeginFreeDash(); } JujutsuSfxAssets.PlayHeavyWhoosh(val, 0.5f); Burst(val, 2.6f, 0.22f); if (!dashing && !crossing) { Burst(Here(), 2.1f, 0.2f); } } private void BeginClosing() { //IL_000f: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) crossing = true; FaceTarget(); behindOffset = -TargetFacing() * (2.6f + target.radius); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.useGravity = false; gravityDisabled = true; JujutsuCloseDash.IgnoreFalls(((EntityState)this).characterBody, ignoring: true); ((EntityState)this).characterMotor.rootMotion = Vector3.zero; ((EntityState)this).characterMotor.disableAirControlUntilCollision = false; } closing.Begin(FootHere(), BehindTarget(), 150f, "gojo"); } private void Arrive() { //IL_0043: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) crossing = false; arrivedAt = ((EntityState)this).fixedAge; RestoreGravity(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } FaceTarget(); Detonate(); Burst(Here(), 2.1f, 0.2f); Plugin.Log.LogInfo((object)($"gojo dash: crossed to {Here()} in {((EntityState)this).fixedAge:0.000}s, " + (closing.Stopped ? "stopped short by something in the way" : "arrived behind the target") + "; target=" + (Object.op_Implicit((Object)(object)target) ? ((Object)target).name : "gone") + ".")); } private Vector3 FootHere() { //IL_001f: 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) if (!Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { return ((EntityState)this).transform.position; } return ((EntityState)this).characterBody.footPosition; } public override void FixedUpdate() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_007c: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (!((EntityState)this).isAuthority) { return; } if (crossing) { if (!HasLivingTarget) { Arrive(); } else if (closing.Advance(((EntityState)this).characterMotor, FootHere(), BehindTarget(), Time.fixedDeltaTime)) { Arrive(); } } else if (dashing) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = travelDirection * 76f; } if (((EntityState)this).fixedAge >= 0.25f) { FinishFreeDash(); } } else if (((EntityState)this).fixedAge >= arrivedAt + 0.18f) { ((EntityState)this).outer.SetNextStateToMain(); } } private void BeginFreeDash() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) dashing = true; travelDirection = ResolveDirection(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = travelDirection; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.useGravity = false; gravityDisabled = true; JujutsuCloseDash.IgnoreFalls(((EntityState)this).characterBody, ignoring: true); ((EntityState)this).characterMotor.velocity = travelDirection * 76f; ((EntityState)this).characterMotor.rootMotion = Vector3.zero; ((EntityState)this).characterMotor.disableAirControlUntilCollision = false; } } private void FinishFreeDash() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) dashing = false; RestoreGravity(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { Vector3 val = travelDirection; if (val.y <= 0f) { Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); val = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : ((EntityState)this).transform.forward)); } ((EntityState)this).characterMotor.velocity = val * 38f; } Plugin.Log.LogInfo((object)($"gojo dash: free dash finished at {((EntityState)this).fixedAge:0.000}s, " + $"now at {Here()}, gravity restored=" + $"{!gravityDisabled}, motor={Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)}.")); Burst(Here(), 2.1f, 0.2f); JujutsuSfxAssets.PlayHeavyWhoosh(Here(), 0.5f); ((EntityState)this).outer.SetNextStateToMain(); } public override void OnExit() { RestoreGravity(); ((EntityState)this).OnExit(); } private void RestoreGravity() { if (gravityDisabled && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.useGravity = true; } if (gravityDisabled) { JujutsuCloseDash.IgnoreFalls(((EntityState)this).characterBody, ignoring: false); } gravityDisabled = false; } private Vector3 Here() { //IL_001f: 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) if (!Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { return ((EntityState)this).transform.position; } return ((EntityState)this).characterBody.corePosition; } private static void Burst(Vector3 at, float size, float life) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) GojoEffects.Strike(at, Vector3.up, size * 0.8f); } private void Detonate() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (!detonated) { detonated = true; Vector3 val = (Object.op_Implicit((Object)(object)target) ? target.corePosition : ((EntityState)this).characterBody.corePosition); Vector3 facing = val - ((EntityState)this).characterBody.corePosition; facing = ((((Vector3)(ref facing)).sqrMagnitude > 0.01f) ? ((Vector3)(ref facing)).normalized : ((EntityState)this).characterBody.transform.forward); if (NetworkServer.active) { BlastServer(val, facing); } else { GojoDashSync.Request(((EntityState)this).characterBody, val, facing); } JujutsuSfxAssets.PlayHeavyWhoosh(val, 0.85f); GojoAssets.PlayAttackSound(GojoAssets.RedSound, val); GojoEffects.Repulse(val, GojoAssets.Red, 9f, 0.7f, facing); } } internal static void BlastFor(CharacterBody attacker, Vector3 centre, Vector3 facing) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)attacker)) { Blast(((Component)attacker).gameObject, attacker, centre, facing, attacker.damage * 16f, Util.CheckRoll(attacker.crit, attacker.master), new HashSet()); } } private void BlastServer(Vector3 centre, Vector3 facing) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) victims.Clear(); Blast(((EntityState)this).gameObject, ((EntityState)this).characterBody, centre, facing, ((BaseState)this).damageStat * 16f, ((BaseState)this).RollCrit(), victims); } private static void Blast(GameObject attackerObject, CharacterBody attacker, Vector3 centre, Vector3 facing, float damage, bool isCritical, HashSet victims) { //IL_0000: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) Collider[] array = GojoDamageUtility.OverlapEnemies(centre, 7.5f); TeamIndex ownerTeam = (TeamIndex)((!Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)attacker.teamComponent)) ? 1 : ((int)attacker.teamComponent.teamIndex)); int num = 0; for (int i = 0; i < array.Length; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(array[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = val.body.corePosition - centre; Vector3 direction = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : facing); GojoDamageUtility.ApplyDamage(attackerObject, val, damage, LaunchForce(val.body, direction), isCritical, 1f, DamageTypeCombo.GenericPrimary, (DamageColorIndex)0); num++; FinishServer(attackerObject, val); } } GojoDamageUtility.ReportSilentPass("Instant Transmission", array.Length, num, damage, centre); } private static void FinishServer(GameObject attackerObject, HealthComponent health) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)health) ? health.body : null); if (Object.op_Implicit((Object)(object)health) && health.alive && Object.op_Implicit((Object)(object)val) && !val.isChampion && !val.isBoss && !(health.combinedHealthFraction > 0.25f)) { GojoDamageUtility.ApplyDamage(attackerObject, health, health.combinedHealth + 1f, Vector3.zero, crit: false, 0f, DamageTypeCombo.GenericPrimary | DamageTypeCombo.op_Implicit((DamageType)2) | DamageTypeCombo.op_Implicit((DamageType)64), (DamageColorIndex)5); } } private static Vector3 LaunchForce(CharacterBody victim, Vector3 direction) { //IL_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006c: 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) float num = ((Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)victim.characterMotor)) ? victim.characterMotor.mass : 100f); num = Mathf.Clamp(num, 60f, 1600f); Vector3 val = direction + Vector3.up * 0.4f; val = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : Vector3.up); return val * (32f * num); } private Vector3 BehindTarget() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Vector3 result = target.corePosition + behindOffset; result.y = target.footPosition.y; return result; } private Vector3 TargetFacing() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0056: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) CharacterDirection component = ((Component)target).GetComponent(); Vector3 val = Vector3.ProjectOnPlane(Object.op_Implicit((Object)(object)component) ? component.forward : target.transform.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(((EntityState)this).characterBody.corePosition - target.corePosition, Vector3.up); } if (!(((Vector3)(ref val)).sqrMagnitude > 0.01f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } private void FaceTarget() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && Object.op_Implicit((Object)(object)target)) { Vector3 val = Vector3.ProjectOnPlane(target.corePosition - ((EntityState)this).characterBody.corePosition, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { ((EntityState)this).characterDirection.forward = ((Vector3)(ref val)).normalized; } } } private CharacterBody FindAimedTarget(Ray aimRay) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!((EntityState)this).isAuthority) { return null; } TeamMask allButNeutral = TeamMask.allButNeutral; ((TeamMask)(ref allButNeutral)).RemoveTeam(((BaseState)this).GetTeam()); BullseyeSearch val = new BullseyeSearch { searchOrigin = ((Ray)(ref aimRay)).origin, searchDirection = ((Ray)(ref aimRay)).direction, maxDistanceFilter = 34f, maxAngleFilter = 24f, teamMaskFilter = allButNeutral, filterByLoS = false, sortMode = (SortMode)2 }; val.RefreshCandidates(); val.FilterOutGameObject(((EntityState)this).gameObject); foreach (HurtBox result in val.GetResults()) { CharacterBody val2 = ((Object.op_Implicit((Object)(object)result) && Object.op_Implicit((Object)(object)result.healthComponent)) ? result.healthComponent.body : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.healthComponent) && val2.healthComponent.alive) { return val2; } } return null; } private Vector3 ResolveDirection() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0043: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) ? ((EntityState)this).inputBank.moveVector : Vector3.zero); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { Ray aimRay = ((BaseState)this).GetAimRay(); val = ((Ray)(ref aimRay)).direction; val.y = 0f; } if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : Vector3.forward); val.y = 0f; } if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { return ((Vector3)(ref val)).normalized; } return Vector3.forward; } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public sealed class GojoJabState : BaseSkillState { internal const float PullDamage = 2.2f; internal const float MiddleDamage = 2.5f; internal const float FinisherDamage = 5.2f; internal const float PullStandoff = 3.6f; internal const float PullRadius = 7.5f; internal const float PullReach = 11.1f; private float duration; private Vector3 aimDirection; private bool attacked; private bool rightHand; private int comboStep; private float damageCoefficient; private float hitRadius; private float hitForce; private float verticalForce; private float stepDistance; private bool pull; public override void OnEnter() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); GojoSideSkillController component = ((Component)((EntityState)this).characterBody).GetComponent(); comboStep = (Object.op_Implicit((Object)(object)component) ? component.ConsumeNextPunchStep() : 0); ConfigureComboStep(); duration /= Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat); Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; aimDirection = ((Vector3)(ref direction)).normalized; ((EntityState)this).characterBody.SetAimTimer(duration + 0.2f); SetPlanarFacing(); GojoModelAnimator gojoModelAnimator = GojoModelAnimator.Find(((EntityState)this).characterBody); rightHand = comboStep != 1; if (Object.op_Implicit((Object)(object)gojoModelAnimator)) { gojoModelAnimator.TriggerPunch(rightHand, duration, comboStep, 0.38f); } JujutsuSfxAssets.PlayMeleeLight(((EntityState)this).characterBody.corePosition); if (GojoStateUtils.HasAnimatorLayer(((EntityState)this).GetModelAnimator(), "Gesture, Additive")) { ((EntityState)this).PlayAnimation("Gesture, Additive", rightHand ? "FirePistol, Right" : "FirePistol, Left"); } } public override void FixedUpdate() { //IL_0167: 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_0189: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00ff: 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_010f: 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_0129: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); GojoStateUtils.SlowMovementDuringAttack(((EntityState)this).characterMotor, ((EntityState)this).isAuthority, 0.75f); if (!attacked && ((EntityState)this).fixedAge >= duration * 0.38f) { attacked = true; if (((EntityState)this).isAuthority) { Vector3 val = Vector3.ProjectOnPlane(aimDirection, Vector3.up); Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = ((EntityState)this).characterBody.transform.forward; } Vector3 val3 = ((EntityState)this).characterBody.corePosition + val2 * (pull ? 3.6f : (1.35f + (float)comboStep * 0.18f)); float damageMultiplier; bool flag = BlackFlash.TryProc(val3, out damageMultiplier); if (GojoMeleeAttackUtility.Fire(((EntityState)this).gameObject, ((EntityState)this).characterBody, ((BaseState)this).GetTeam(), val3, hitRadius, ((BaseState)this).damageStat * damageCoefficient * damageMultiplier, val2 * hitForce + Vector3.up * verticalForce, ((BaseState)this).RollCrit() || flag, DamageTypeCombo.GenericPrimary) > 0) { JujutsuSfxAssets.PlayMeleeHeavy(val3); ((Component)((EntityState)this).characterBody).GetComponent()?.RestoreFromMelee((comboStep == 2) ? 14f : 9f); } } GojoStateUtils.StepIntoBlow(((EntityState)this).characterMotor, ((EntityState)this).isAuthority, aimDirection, stepDistance); ShowSwing(((EntityState)this).characterBody.corePosition + ((Vector3)(ref aimDirection)).normalized * (1.35f + (float)comboStep * 0.18f)); } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void ConfigureComboStep() { switch (comboStep) { case 1: duration = 0.58f; damageCoefficient = 2.5f; hitRadius = 3.2f; hitForce = 700f; verticalForce = 0f; stepDistance = 0.6f; pull = false; break; case 2: duration = 0.85f; damageCoefficient = 5.2f; hitRadius = 3.8f; hitForce = 4200f; verticalForce = 650f; stepDistance = 0.95f; pull = false; break; default: duration = 0.55f; damageCoefficient = 2.2f; hitRadius = 7.5f; hitForce = -3400f; verticalForce = -150f; stepDistance = 1.2f; pull = true; break; } } public override InterruptPriority GetMinimumInterruptPriority() { if (attacked) { return (InterruptPriority)0; } return (InterruptPriority)2; } private void ShowSwing(Vector3 point) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0040: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) Vector3 facing = ((((Vector3)(ref aimDirection)).sqrMagnitude > 0.0001f) ? aimDirection : ((EntityState)this).characterBody.transform.forward); switch (comboStep) { case 1: GojoEffects.Strike(point, facing, 1.9f); RuntimeVisuals.CreateOrb(point, GojoAssets.Red, 0.5f, 0.22f)?.BurstAndDestroy(1.8f, 0.1f); break; case 2: GojoEffects.Strike(point, facing, 3.4f); GojoEffects.Repulse(point, GojoAssets.Red, 4.2f, 0.34f, facing); RuntimeVisuals.CreateOrb(point, GojoAssets.Red, 1.1f, 0.34f)?.BurstAndDestroy(4.2f, 0.16f); JujutsuSfxAssets.PlayHeavyWhoosh(point, 0.55f); break; default: GojoEffects.Strike(point, facing, 1.6f); GojoEffects.Collapse(point, GojoAssets.Blue, 2.8f, 0.3f); RuntimeVisuals.CreateOrb(point, GojoAssets.Blue, 0.75f, 0.3f)?.BurstAndDestroy(0.25f, 0.18f); break; } } private void SetPlanarFacing() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(aimDirection, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && ((Vector3)(ref normalized)).sqrMagnitude > 0.01f) { ((EntityState)this).characterDirection.forward = normalized; } } } public sealed class GojoKickState : BaseSkillState { internal const float Damage = 7.5f; internal const float Radius = 6f; private float duration; private Vector3 aimDirection; private bool attacked; public override void OnEnter() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = 0.7f / Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat); Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; aimDirection = ((Vector3)(ref direction)).normalized; ((EntityState)this).characterBody.SetAimTimer(duration + 0.25f); SetPlanarFacing(); GojoModelAnimator.Find(((EntityState)this).characterBody)?.TriggerSpinKick(duration); JujutsuSfxAssets.PlayMeleeHeavy(((EntityState)this).characterBody.corePosition); if (GojoStateUtils.HasAnimatorLayer(((EntityState)this).GetModelAnimator(), "FullBody, Override")) { ((EntityState)this).PlayAnimation("FullBody, Override", "Roll"); } } public override void FixedUpdate() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); GojoStateUtils.SlowMovementDuringAttack(((EntityState)this).characterMotor, ((EntityState)this).isAuthority, 0.5f); if (!attacked && ((EntityState)this).fixedAge >= duration * 0.48f) { attacked = true; if (((EntityState)this).isAuthority) { float damageMultiplier; bool flag = BlackFlash.TryProc(((EntityState)this).characterBody.corePosition, out damageMultiplier); if (GojoMeleeAttackUtility.FireRadial(((EntityState)this).gameObject, ((EntityState)this).characterBody, ((BaseState)this).GetTeam(), ((EntityState)this).characterBody.corePosition + Vector3.up * 0.15f, 6f, ((BaseState)this).damageStat * 7.5f * damageMultiplier, 3400f, 900f, ((BaseState)this).RollCrit() || flag, DamageTypeCombo.GenericSecondary) > 0) { JujutsuSfxAssets.PlayMeleeHeavy(((EntityState)this).characterBody.corePosition); ((Component)((EntityState)this).characterBody).GetComponent()?.RestoreFromMelee(12f); } } GojoStateUtils.StepIntoBlow(((EntityState)this).characterMotor, ((EntityState)this).isAuthority, aimDirection, 2.6f); } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void SetPlanarFacing() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(aimDirection, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && ((Vector3)(ref normalized)).sqrMagnitude > 0.01f) { ((EntityState)this).characterDirection.forward = normalized; } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } internal static class GojoMeleeAttackUtility { internal static int Fire(GameObject attacker, CharacterBody ownerBody, TeamIndex ownerTeam, Vector3 center, float radius, float damage, Vector3 force, bool crit, DamageTypeCombo damageType) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!Object.op_Implicit((Object)(object)attacker)) { return 0; } return new BlastAttack { attacker = attacker, inflictor = attacker, teamIndex = ownerTeam, attackerFiltering = (AttackerFiltering)2, position = center, radius = radius, falloffModel = (FalloffModel)0, baseDamage = damage, baseForce = 0f, bonusForce = GojoDamageUtility.Knockback(force), crit = crit, procCoefficient = 1f, damageColorIndex = (DamageColorIndex)0, damageType = damageType, losType = (LoSType)0 }.Fire().hitCount; } internal static int FireRadial(GameObject attacker, CharacterBody ownerBody, TeamIndex ownerTeam, Vector3 center, float radius, float damage, float radialForce, float upwardForce, bool crit, DamageTypeCombo damageType) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)attacker)) { return 0; } return new BlastAttack { attacker = attacker, inflictor = attacker, teamIndex = ownerTeam, attackerFiltering = (AttackerFiltering)2, position = center, radius = radius, falloffModel = (FalloffModel)0, baseDamage = damage, baseForce = GojoDamageUtility.Knockback(radialForce), bonusForce = GojoDamageUtility.Knockback(Vector3.up * upwardForce), crit = crit, procCoefficient = 1f, damageColorIndex = (DamageColorIndex)0, damageType = damageType, losType = (LoSType)0 }.Fire().hitCount; } } internal static class GojoStateUtils { internal const float OrbOverchargeDelay = 1f; internal const float OrbMaximumOverchargeEnergy = 50f; internal const float OrbOverchargeEnergyPerSecond = 20f; internal static void NoSprintDuring(CharacterBody body, bool isAuthority) { if (isAuthority && Object.op_Implicit((Object)(object)body)) { body.isSprinting = false; } } internal static void SlowMovementDuringAttack(CharacterMotor motor, bool isAuthority, float retainedFraction) { //IL_000e: 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) if (isAuthority && Object.op_Implicit((Object)(object)motor)) { motor.moveDirection *= Mathf.Clamp01(retainedFraction); } } internal static void StepIntoBlow(CharacterMotor motor, bool isAuthority, Vector3 aimDirection, float distance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (isAuthority && Object.op_Implicit((Object)(object)motor)) { Vector3 val = Vector3.ProjectOnPlane(aimDirection, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; if (!(((Vector3)(ref normalized)).sqrMagnitude < 0.01f)) { motor.rootMotion += normalized * distance; } } } internal static float InvestOrbOvercharge(CharacterBody owner, float stateAge, float investedEnergy, bool spendEnergy, float rateScale = 1f) { investedEnergy = Mathf.Clamp(investedEnergy, 0f, 50f); if (!Object.op_Implicit((Object)(object)owner) || stateAge <= 1f || investedEnergy >= 50f) { return investedEnergy; } float num = Mathf.Min(20f * Mathf.Max(0.01f, rateScale) * Time.fixedDeltaTime, 50f - investedEnergy); if (!spendEnergy) { return Mathf.Min(investedEnergy + num, 50f); } CursedEnergyController component = ((Component)owner).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || component.Current <= 0f) { return investedEnergy; } num = Mathf.Min(num, component.Current); if (num > 0f && component.TrySpend(num)) { investedEnergy += num; } return Mathf.Min(investedEnergy, 50f); } internal static float GetOrbOverchargeFraction(float investedEnergy) { return Mathf.Clamp01(investedEnergy / 50f); } internal static Vector3 CalculateControlledOrbPosition(Vector3 ownerPosition, Ray aimRay, ref float controlDistance, float scrollInput, float distancePerScrollStep) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) controlDistance = Mathf.Clamp(controlDistance + scrollInput * Mathf.Max(1f, distancePerScrollStep), 2f, 120f); Vector3 direction = ((Ray)(ref aimRay)).direction; Vector3 normalized = ((Vector3)(ref direction)).normalized; Vector3 val = ownerPosition + normalized * controlDistance; RaycastHit val2 = default(RaycastHit); if (Physics.Linecast(ownerPosition, val, ref val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { val = ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.15f; } return val; } internal static Vector3 FindAimPoint(Ray aimRay, float maxDistance) { //IL_0000: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(aimRay, ref val, maxDistance, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point; } return ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * maxDistance; } internal static bool HasAnimatorLayer(Animator animator, string layerName) { if (Object.op_Implicit((Object)(object)animator) && Object.op_Implicit((Object)(object)animator.runtimeAnimatorController)) { return animator.GetLayerIndex(layerName) >= 0; } return false; } } internal interface IPurpleCastPose { bool DrivesPose { get; } float AnimationPhase { get; } } public sealed class HollowPurpleState : BaseSkillState, IPurpleCastPose { internal const float MinimumChargeDuration = 3.78f; internal const float MaximumChargeDuration = 6f; internal const float EnergyReserve = 5f; private const float CostCurve = 2.5f; internal static readonly float MinimumChargeCostFraction = Mathf.Pow(0.63f, 2.5f); internal const float MinimumChargeFraction = 0.63f; private const float MergeChargeFraction = 0.62f; private const float OrbStandoff = 1.9f; private RuntimeOrbVisual orbVisual; private RuntimeOrbVisual redVisual; private RuntimeOrbVisual blueVisual; private Vector3 orbPosition; private Vector3 direction; private float visualRadius; private float paidEnergy; private bool launched; public float AnimationPhase => Mathf.Clamp01(((EntityState)this).fixedAge / 6f); public bool DrivesPose => !launched; public override void OnEnter() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(10.4f); RootedArmorController.Find(((EntityState)this).characterBody)?.Push(); UpdateChargeVisuals(0f); if (GojoAssets.PurpleSound != null) { GojoAssets.PlayAttackSound(GojoAssets.PurpleSound, ((EntityState)this).characterBody.corePosition, 1f, 0f, "Gojo", spokenLine: true); } else { Util.PlaySound("Play_voidRaid_snipe_shoot_final", ((EntityState)this).gameObject); } if (GojoStateUtils.HasAnimatorLayer(((EntityState)this).GetModelAnimator(), "Gesture, Additive")) { ((EntityState)this).PlayAnimation("Gesture, Additive", "FirePistol, Left"); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (launched) { return; } float charge = Mathf.Clamp01(((EntityState)this).fixedAge / 6f); UpdateChargeVisuals(charge); if (!((EntityState)this).isAuthority) { return; } if (!PayForCharge(charge)) { Launch(charge); return; } bool flag = Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.skill4.down; if (((EntityState)this).fixedAge >= 6f || (((EntityState)this).fixedAge >= 3.78f && !flag)) { Launch(charge); } } private bool PayForCharge(float charge) { CursedEnergyController component = ((Component)((EntityState)this).characterBody).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return true; } float num = Mathf.Max(0f, component.Maximum - 5f); if (paidEnergy <= 0f) { paidEnergy = MinimumChargeCostFraction * component.Maximum; } float num2 = Mathf.Pow(Mathf.Clamp01(charge), 2.5f) * num - paidEnergy; if (num2 <= 0f) { return true; } if (!component.TrySpend(num2)) { return false; } paidEnergy += num2; return true; } private void Launch(float charge) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) launched = true; Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 val = ((Ray)(ref aimRay)).direction; direction = ((Vector3)(ref val)).normalized; float num = Mathf.Max(1.4f, visualRadius); RefundCooldown(((BaseSkillState)this).activatorSkillSlot, charge); Vector3 val2 = ((EntityState)this).characterBody.corePosition + direction * (1.9f + num); ((EntityState)this).outer.SetNextState((EntityState)(object)new HollowPurpleProjectileState { Direction = direction, OrbPosition = val2, VisualRadius = num, LaunchCharge = charge, LaunchPose = AnimationPhase, IsCritical = ((BaseState)this).RollCrit() }); } internal static void RefundCooldown(GenericSkill slot, float charge) { if (Object.op_Implicit((Object)(object)slot)) { float num = Mathf.InverseLerp(0.63f, 1f, Mathf.Clamp01(charge)); float num2 = Mathf.Lerp(0.33f, 1f, num); float num3 = slot.finalRechargeInterval * (1f - num2); if (num3 > 0f) { slot.RunRecharge(num3); } } } private void UpdateChargeVisuals(float charge) { //IL_0184: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e8: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0101: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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) float radius = ((charge < 0.62f) ? 0.75f : Mathf.Lerp(0.75f, 10.2f, Mathf.InverseLerp(0.62f, 1f, charge))); CalculateChargeAnchors(radius, out var redHand, out var blueHand, out var mergePoint, out var effectUp); if (charge < 0.62f) { if (!Object.op_Implicit((Object)(object)redVisual)) { redVisual = RuntimeVisuals.CreateOrb(redHand, GojoAssets.Red, 0.38f); } if (!Object.op_Implicit((Object)(object)blueVisual)) { blueVisual = RuntimeVisuals.CreateOrb(blueHand, GojoAssets.Blue, 0.38f, 0f, GojoTechniqueStyle.Blue); } float num = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.18f, 0.62f, charge)); float num2 = Mathf.Sin(num * MathF.PI) * 0.3f; Vector3 position = Vector3.Lerp(redHand, mergePoint, num) + effectUp * num2; Vector3 position2 = Vector3.Lerp(blueHand, mergePoint, num) - effectUp * num2; float radius2 = Mathf.Lerp(0.38f, 0.82f, num); if (Object.op_Implicit((Object)(object)redVisual)) { redVisual.SetPosition(position); redVisual.SetRadius(radius2); } if (Object.op_Implicit((Object)(object)blueVisual)) { blueVisual.SetPosition(position2); blueVisual.SetRadius(radius2); } orbPosition = mergePoint; visualRadius = Mathf.Lerp(0.75f, 2.4f, num); } else { MergeSources(mergePoint); visualRadius = radius; orbPosition = mergePoint; if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.SetPosition(orbPosition); orbVisual.SetRadius(visualRadius); orbVisual.TriggerPulse(0.12f); } } } private void CalculateChargeAnchors(float radius, out Vector3 redHand, out Vector3 blueHand, out Vector3 mergePoint, out Vector3 effectUp) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_007b: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 val = ((Ray)(ref aimRay)).direction; direction = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(Vector3.up, direction); if (((Vector3)(ref val2)).sqrMagnitude < 0.001f) { val2 = ((EntityState)this).characterBody.transform.right; } ((Vector3)(ref val2)).Normalize(); val = Vector3.Cross(direction, val2); effectUp = ((Vector3)(ref val)).normalized; Vector3 corePosition = ((EntityState)this).characterBody.corePosition; redHand = corePosition + val2 * 0.85f + effectUp * 0.1f + direction * 1.15f; blueHand = corePosition - val2 * 0.85f + effectUp * 0.1f + direction * 1.15f; mergePoint = corePosition + direction * (1.9f + radius) + effectUp * 0.12f; } private void MergeSources(Vector3 mergePoint) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) DestroySourceOrbs(); if (!Object.op_Implicit((Object)(object)orbVisual)) { JujutsuSfxAssets.PlayHeavyWhoosh(mergePoint, 0.34f); orbVisual = RuntimeVisuals.CreateOrb(mergePoint, GojoAssets.Purple, 0.75f, 0.85f, GojoTechniqueStyle.Purple); orbVisual?.TriggerPulse(0.35f); GojoEffects.Hollow(mergePoint, GojoAssets.Purple, 3.6f, 0.72f); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Hollow Purple: sources merged at " + $"{((EntityState)this).fixedAge:0.00}s of charge.")); } } } private void DestroySourceOrbs() { if (Object.op_Implicit((Object)(object)redVisual)) { EntityState.Destroy((Object)(object)((Component)redVisual).gameObject); redVisual = null; } if (Object.op_Implicit((Object)(object)blueVisual)) { EntityState.Destroy((Object)(object)((Component)blueVisual).gameObject); blueVisual = null; } } public override void OnExit() { RootedArmorController.Find(((EntityState)this).characterBody)?.Pop(); DestroySourceOrbs(); if (Object.op_Implicit((Object)(object)orbVisual)) { EntityState.Destroy((Object)(object)((Component)orbVisual).gameObject); orbVisual = null; } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public sealed class HollowPurpleProjectileState : BaseState, IPurpleCastPose { internal const float ProjectileLifetime = 3.4f; private const float ProjectileSpeed = 58f; internal const float FullChargeDamageRadius = 5.5f; internal const float FullChargeFinalRadius = 24f; private const float RecoveryDuration = 0.4f; private const float PoseFollowThroughDuration = 1f; private const float MinimumLaunchRecoil = 5f; private const float MaximumLaunchRecoil = 11f; private const float LaunchRecoilLift = 1.5f; internal Vector3 Direction; internal Vector3 OrbPosition; internal float VisualRadius; internal float LaunchCharge; internal float LaunchPose; internal bool IsCritical; private readonly HashSet victims = new HashSet(); private RuntimeOrbVisual orbVisual; private float finishedAt; private bool finished; private const float LargestVisualRadius = 2.4f; internal float DamageRadius => Mathf.Max(2.5f, VisualRadius * 0.54f); internal float FinalRadius => Mathf.Max(7f, VisualRadius * 2.35f); public float AnimationPhase => Mathf.Clamp01(LaunchPose + ((EntityState)this).fixedAge / 6f); public bool DrivesPose => ((EntityState)this).fixedAge < 1f; private float TravelSpeed { get { float num = 2.4f / Mathf.Max(VisualRadius, 0.5f); return 58f * Mathf.Clamp(num * num, 1f, 2.6f); } } public override void OnEnter() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); RootedArmorController.Find(((EntityState)this).characterBody)?.Push(); if (((Vector3)(ref Direction)).sqrMagnitude < 0.01f) { Direction = (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((EntityState)this).characterBody.transform.forward : Vector3.forward); } ((Vector3)(ref Direction)).Normalize(); orbVisual = RuntimeVisuals.CreateOrb(OrbPosition, GojoAssets.Purple, VisualRadius, 0.85f, GojoTechniqueStyle.Purple); orbVisual?.TriggerPulse(0.35f); if (NetworkServer.active) { DamageLaunchCorridorServer(); } JujutsuSfxAssets.PlayHeavyWhoosh(OrbPosition, 0.92f); GojoEffects.Hollow(OrbPosition, GojoAssets.Purple, VisualRadius * 1.45f, 0.85f); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)($"Hollow Purple: launched at charge {LaunchCharge:0.00}, " + $"radius {VisualRadius:0.0}.")); } if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-8f, -12f, -2.5f, 2.5f); ApplyLaunchRecoil(); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!finished) { bool num = MoveProjectile(); if (NetworkServer.active) { DamageSphereServer(DamageRadius, 1f, 1f); } if (num || ((EntityState)this).fixedAge >= 3.4f) { FinishProjectile(); } } if (finished && ((EntityState)this).fixedAge >= finishedAt + 0.4f && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void ApplyLaunchRecoil() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0068: 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_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) if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { Vector3 val = Vector3.ProjectOnPlane(Direction, Vector3.up); if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { ((Vector3)(ref val)).Normalize(); float num = Mathf.Lerp(5f, 11f, Mathf.Clamp01(LaunchCharge)); CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += -val * num + Vector3.up * 1.5f; } } } private bool MoveProjectile() { //IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) float num = TravelSpeed * Time.fixedDeltaTime; Vector3 val = OrbPosition + Direction * num; RaycastHit val2 = default(RaycastHit); bool flag = Physics.Linecast(OrbPosition, val, ref val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); OrbPosition = (flag ? (((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.2f) : val); if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.SetPosition(OrbPosition); orbVisual.SetRadius(VisualRadius); } return flag; } private void FinishProjectile() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!finished) { finished = true; finishedAt = ((EntityState)this).fixedAge; if (NetworkServer.active) { DamageSphereServer(FinalRadius, 0.35f, 0.35f); } if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.BurstAndDestroy(FinalRadius, 0.32f); orbVisual = null; } GojoEffects.Repulse(OrbPosition, GojoAssets.Purple, FinalRadius * 1.18f, 1.05f); JujutsuSfxAssets.PlayHeavyWhoosh(OrbPosition, 0.72f); JujutsuFxShake.Detonation(OrbPosition, FinalRadius); } } private void DamageLaunchCorridorServer() { //IL_0007: 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) ApplyToColliders(GojoDamageUtility.OverlapEnemiesBetween(((EntityState)this).characterBody.corePosition, OrbPosition, DamageRadius), 1f, 1f); } private void DamageSphereServer(float radius, float damageMultiplier, float procCoefficient) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ApplyToColliders(GojoDamageUtility.OverlapEnemies(OrbPosition, radius), damageMultiplier, procCoefficient); } private void ApplyToColliders(Collider[] colliders, float damageMultiplier, float procCoefficient) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) TeamIndex team = ((BaseState)this).GetTeam(); float damage = base.damageStat * JujutsuConfig.PurpleDamage.Value * GetChargeDamageMultiplier() * damageMultiplier; int num = 0; for (int i = 0; i < colliders.Length; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(colliders[i], team, victims); if (Object.op_Implicit((Object)(object)val)) { GojoDamageUtility.ApplyDamage(((EntityState)this).gameObject, val, damage, Direction * 3500f, IsCritical, procCoefficient, DamageTypeCombo.GenericSpecial, (DamageColorIndex)9); num++; } } GojoDamageUtility.ReportSilentPass("Hollow Purple", colliders.Length, num, damage, OrbPosition); } private float GetChargeDamageMultiplier() { float num = Mathf.InverseLerp(0.63f, 1f, LaunchCharge); return Mathf.Lerp(1f, Mathf.Max(1f, JujutsuConfig.PurpleChargedDamageMultiplier.Value), num); } public override void OnExit() { RootedArmorController.Find(((EntityState)this).characterBody)?.Pop(); if (Object.op_Implicit((Object)(object)orbVisual)) { EntityState.Destroy((Object)(object)((Component)orbVisual).gameObject); orbVisual = null; } ((EntityState)this).OnExit(); } public override void OnSerialize(NetworkWriter writer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnSerialize(writer); writer.Write(OrbPosition); writer.Write(Direction); writer.Write(VisualRadius); writer.Write(LaunchCharge); writer.Write(IsCritical); } public override void OnDeserialize(NetworkReader reader) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).OnDeserialize(reader); OrbPosition = reader.ReadVector3(); Direction = reader.ReadVector3(); VisualRadius = reader.ReadSingle(); LaunchCharge = reader.ReadSingle(); IsCritical = reader.ReadBoolean(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public sealed class InfinityState : BaseSkillState { private float duration; private float healedTarget; internal float AnimationPhase => Mathf.Clamp01(((EntityState)this).fixedAge / Mathf.Max(0.25f, duration)); public override void OnEnter() { //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) ((BaseState)this).OnEnter(); duration = Mathf.Max(0.25f, JujutsuConfig.HealingDuration.Value); ((EntityState)this).characterBody.SetAimTimer(duration); RootedArmorController.Find(((EntityState)this).characterBody)?.Push(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } } public override void FixedUpdate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) ((EntityState)this).FixedUpdate(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive) { HealthComponent healthComponent = ((EntityState)this).characterBody.healthComponent; float num = Mathf.Max(0f, JujutsuConfig.HealingFraction.Value); float num2 = healthComponent.fullHealth * num * Mathf.Clamp01(((EntityState)this).fixedAge / duration); float num3 = num2 - healedTarget; if (num3 > 0f) { healthComponent.Heal(num3, default(ProcChainMask), true); healedTarget = num2; } } if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { RootedArmorController.Find(((EntityState)this).characterBody)?.Pop(); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)7; } } internal static class JujutsuDamageUtility { internal static void FireCapsule(GameObject attacker, TeamIndex ownerTeam, Vector3 start, Vector3 end, float radius, float damage, Vector3 force, bool crit, float procCoefficient, DamageTypeCombo damageType, HashSet victims = null) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) if (NetworkServer.active) { Collider[] colliders = Physics.OverlapCapsule(start, end, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); DamageVictims(attacker, ownerTeam, colliders, damage, force, crit, procCoefficient, damageType, adaptive: false, victims); } } internal static void FireCapsuleSegment(GameObject attacker, TeamIndex ownerTeam, Vector3 start, Vector3 end, float radius, float damage, Vector3 force, bool crit, float procCoefficient, DamageTypeCombo damageType, HashSet victims) { //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_0011: 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_003e: 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) if (!NetworkServer.active) { return; } Collider[] array = Physics.OverlapCapsule(start, end, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { HealthComponent val = FindEnemyHealth(array[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val)) { ApplyDamage(attacker, val, damage, force, crit, procCoefficient, damageType); } } } internal static void FireAdaptiveSphere(GameObject attacker, TeamIndex ownerTeam, Vector3 center, float radius, float baseDamage, Vector3 force, bool crit, float procCoefficient, DamageTypeCombo damageType) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { Collider[] colliders = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); DamageVictims(attacker, ownerTeam, colliders, baseDamage, force, crit, procCoefficient, damageType, adaptive: true); } } internal static void FireSphere(GameObject attacker, TeamIndex ownerTeam, Vector3 center, float radius, float damage, float radialForce, float upwardForce, bool crit, float procCoefficient, DamageTypeCombo damageType) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0043: 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) //IL_004e: 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_0080: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) if (!NetworkServer.active) { return; } Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); HashSet victims = new HashSet(); for (int i = 0; i < array.Length; i++) { HealthComponent val = FindEnemyHealth(array[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = val.body.corePosition - center; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.forward; } ((Vector3)(ref val2)).Normalize(); ApplyDamage(attacker, val, damage, val2 * radialForce + Vector3.up * upwardForce, crit, procCoefficient, damageType); } } } internal static bool TryFindFirstEnemyAlong(TeamIndex ownerTeam, Vector3 start, Vector3 end, float radius, out Vector3 hitPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) hitPosition = end; Collider[] array = Physics.OverlapCapsule(start, end, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); if (array.Length == 0) { return false; } HashSet victims = new HashSet(); float num = float.MaxValue; bool result = false; for (int i = 0; i < array.Length; i++) { HealthComponent val = FindEnemyHealth(array[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.body)) { Vector3 corePosition = val.body.corePosition; Vector3 val2 = corePosition - start; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; hitPosition = corePosition; result = true; } } } return result; } internal static void IgniteSphere(GameObject attacker, TeamIndex ownerTeam, Vector3 center, float radius, float duration, float damageMultiplier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) if (!NetworkServer.active) { return; } Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)2); HashSet victims = new HashSet(); for (int i = 0; i < array.Length; i++) { HealthComponent val = FindEnemyHealth(array[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val)) { DotController.InflictDot(((Component)val).gameObject, attacker, (HurtBox)null, (DotIndex)7, duration, damageMultiplier, (uint?)null); } } } private static void DamageVictims(GameObject attacker, TeamIndex ownerTeam, Collider[] colliders, float baseDamage, Vector3 force, bool crit, float procCoefficient, DamageTypeCombo damageType, bool adaptive, HashSet sharedVictims = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) HashSet victims = sharedVictims ?? new HashSet(); for (int i = 0; i < colliders.Length; i++) { HealthComponent val = FindEnemyHealth(colliders[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val)) { float num = baseDamage; if (adaptive) { float num2 = 1f - Mathf.Clamp01(val.combinedHealthFraction); num *= Mathf.Lerp(1f, 2.25f, num2); } ApplyDamage(attacker, val, num, force, crit, procCoefficient, damageType); } } } private static HealthComponent FindEnemyHealth(Collider collider, TeamIndex ownerTeam, HashSet victims) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) HurtBox val = (Object.op_Implicit((Object)(object)collider) ? ((Component)collider).GetComponent() : null); HealthComponent val2 = (Object.op_Implicit((Object)(object)val) ? val.healthComponent : null); CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.body : null); if (!Object.op_Implicit((Object)(object)val2) || !val2.alive || !Object.op_Implicit((Object)(object)val3) || victims.Contains(val2)) { return null; } if (Object.op_Implicit((Object)(object)val3.teamComponent) && val3.teamComponent.teamIndex == ownerTeam) { return null; } victims.Add(val2); return val2; } private static void ApplyDamage(GameObject attacker, HealthComponent health, float damage, Vector3 force, bool crit, float procCoefficient, DamageTypeCombo damageType) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) GojoDamageUtility.ApplyDamage(attacker, health, damage, force, crit, procCoefficient, damageType, (DamageColorIndex)0); } } public sealed class LapseBlueState : BaseSkillState { private const float MinimumControlDuration = 0.35f; private const float ChargeRateScale = 2f / 3f; private const float MaximumControlDuration = 5.25f; private const float BaseHoldEffectRadius = 7f; private const float MaximumHoldEffectRadius = 12f; private const float HoldTickInterval = 0.3f; private readonly HashSet victims = new HashSet(); private RuntimeOrbVisual orbVisual; private Vector3 orbPosition; private Vector3 aimDirection; private float controlDistance; private GojoOrbCameraController cameraController; private float holdTickStopwatch; private float overchargeEnergy; private bool activated; internal float AnimationPhase => Mathf.Clamp01(((EntityState)this).fixedAge / 0.35f); private float OverchargeFraction => GojoStateUtils.GetOrbOverchargeFraction(overchargeEnergy); public override void OnEnter() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00ba: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(6.25f); Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; aimDirection = ((Vector3)(ref direction)).normalized; controlDistance = 2f; orbPosition = ((EntityState)this).characterBody.corePosition + aimDirection * controlDistance; if (((EntityState)this).isAuthority) { cameraController = ((Component)((EntityState)this).characterBody).GetComponent(); cameraController?.BeginControl(); } orbVisual = RuntimeVisuals.CreateOrb(orbPosition, GojoAssets.Blue, 1.2f, 0.55f, GojoTechniqueStyle.Blue); GojoAssets.PlayAttackSound(GojoAssets.BlueSound, ((EntityState)this).characterBody.corePosition, 0.9f, 8f, "Gojo", spokenLine: true); if (GojoStateUtils.HasAnimatorLayer(((EntityState)this).GetModelAnimator(), "Gesture, Additive")) { ((EntityState)this).PlayAnimation("Gesture, Additive", "FirePistol, Right"); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!activated) { GojoSideSkillController component = ((Component)((EntityState)this).characterBody).GetComponent(); bool flag = !((EntityState)this).isAuthority || (Object.op_Implicit((Object)(object)component) && component.BlueHeld); if ((((EntityState)this).isAuthority || NetworkServer.active) && flag) { overchargeEnergy = GojoStateUtils.InvestOrbOvercharge(((EntityState)this).characterBody, ((EntityState)this).fixedAge, overchargeEnergy, ((EntityState)this).isAuthority, 2f / 3f); } UpdateControlledOrb(); UpdateHoldEffect(); if (((EntityState)this).fixedAge >= 5.25f || (((EntityState)this).fixedAge >= 0.35f && !flag)) { ActivateField(); } } if (activated && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void UpdateHoldEffect() { holdTickStopwatch += Time.fixedDeltaTime; if (!(holdTickStopwatch < 0.3f)) { holdTickStopwatch -= 0.3f; if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.TriggerPulse(0.18f); } if (NetworkServer.active) { DamageAndPullWhileControlledServer(); } } } private void DamageAndPullWhileControlledServer() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) victims.Clear(); float overchargeFraction = OverchargeFraction; Collider[] array = GojoDamageUtility.OverlapEnemies(orbPosition, Mathf.Lerp(7f, 12f, overchargeFraction)); TeamIndex team = ((BaseState)this).GetTeam(); bool crit = ((BaseState)this).RollCrit(); float damage = ((BaseState)this).damageStat * JujutsuConfig.BlueDamagePerTick.Value * 0.45f * Mathf.Lerp(1f, 2.5f, overchargeFraction); for (int i = 0; i < array.Length; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(array[i], team, victims); if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = orbPosition - val.body.corePosition; Vector3 force = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? (((Vector3)(ref val2)).normalized * 950f * Mathf.Lerp(1f, 2.75f, overchargeFraction)) : Vector3.zero); GojoDamageUtility.ApplyDamage(((EntityState)this).gameObject, val, damage, force, crit, 0.1f, DamageTypeCombo.GenericSecondary, (DamageColorIndex)0); } } } private void UpdateControlledOrb() { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) float distancePerScrollStep = JujutsuConfig.BlueControlSpeed.Value * 0.18f; float scrollInput = cameraController?.ConsumeScrollInput() ?? 0f; Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; aimDirection = ((Vector3)(ref direction)).normalized; GojoOrbSync component = ((Component)((EntityState)this).characterBody).GetComponent(); if (!((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)component) && !float.IsNaN(component.ReportedDistance)) { controlDistance = component.ReportedDistance; } orbPosition = GojoStateUtils.CalculateControlledOrbPosition(((EntityState)this).characterBody.corePosition, aimRay, ref controlDistance, scrollInput, distancePerScrollStep); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)component)) { component.Report(controlDistance); } if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.SetPosition(orbPosition); orbVisual.SetRadius(Mathf.Lerp(1.2f, 3.5f, OverchargeFraction)); } } private void ActivateField() { //IL_0035: 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) activated = true; CharacterBody characterBody = ((EntityState)this).characterBody; if (characterBody != null) { ((Component)characterBody).GetComponent()?.ReportResolved("Lapse Blue", controlDistance, ((EntityState)this).isAuthority); } JujutsuSfxAssets.PlayHeavyWhoosh(orbPosition, 0.68f); BlueFieldController component = ((Component)((EntityState)this).characterBody).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.Activate(orbPosition, ((BaseState)this).damageStat, ((BaseState)this).RollCrit(), OverchargeFraction); } if (Object.op_Implicit((Object)(object)orbVisual)) { EntityState.Destroy((Object)(object)((Component)orbVisual).gameObject); orbVisual = null; } } public override void OnExit() { if (!activated && NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive) { ActivateField(); } CharacterBody characterBody = ((EntityState)this).characterBody; if (characterBody != null) { ((Component)characterBody).GetComponent()?.Clear(); } cameraController?.EndControl(); cameraController = null; if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.BurstAndDestroy(0.1f, 0.15f); orbVisual = null; } ((EntityState)this).OnExit(); } public override void OnSerialize(NetworkWriter writer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnSerialize(writer); writer.Write(orbPosition); writer.Write(aimDirection); writer.Write(controlDistance); writer.Write(overchargeEnergy); } public override void OnDeserialize(NetworkReader reader) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnDeserialize(reader); orbPosition = reader.ReadVector3(); aimDirection = reader.ReadVector3(); controlDistance = reader.ReadSingle(); overchargeEnergy = reader.ReadSingle(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public sealed class ReversalRedState : BaseSkillState { private const float MinimumControlDuration = 0.35f; private const float MaximumControlDuration = 4f; internal const float BaseExplosionRadius = 7f; internal const float MaximumExplosionRadius = 14f; internal const float MaximumChargeDamageMultiplier = 3f; private const float BaseHoldDamageRadius = 4.5f; private const float MaximumHoldDamageRadius = 8f; private const float HoldTickInterval = 0.3f; private const float FlightSpeed = 62f; private const float MaximumFlightDuration = 6f; private const float FlightContactRadius = 2.5f; private readonly HashSet victims = new HashSet(); private RuntimeOrbVisual orbVisual; private Vector3 orbPosition; private Vector3 aimDirection; private float controlDistance; private GojoOrbCameraController cameraController; private float holdTickStopwatch; private float overchargeEnergy; private bool detonated; private bool released; private bool detonateInPlaceRequested; private float releasedAt; private Vector3 flightDirection; internal float AnimationPhase => Mathf.Clamp01(((EntityState)this).fixedAge / 0.35f); private float OverchargeFraction => GojoStateUtils.GetOrbOverchargeFraction(overchargeEnergy); public override void OnEnter() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00ba: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(5f); Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; aimDirection = ((Vector3)(ref direction)).normalized; controlDistance = 2f; orbPosition = ((EntityState)this).characterBody.corePosition + aimDirection * controlDistance; if (((EntityState)this).isAuthority) { cameraController = ((Component)((EntityState)this).characterBody).GetComponent(); cameraController?.BeginControl(); } orbVisual = RuntimeVisuals.CreateOrb(orbPosition, GojoAssets.Red, 1.15f, 0.4f); GojoAssets.PlayAttackSound(GojoAssets.RedSound, ((EntityState)this).characterBody.corePosition, 0.9f, 8f, "Gojo", spokenLine: true); if (GojoStateUtils.HasAnimatorLayer(((EntityState)this).GetModelAnimator(), "Gesture, Additive")) { ((EntityState)this).PlayAnimation("Gesture, Additive", "FirePistol, Left"); } } public override void Update() { ((EntityState)this).Update(); if (((EntityState)this).isAuthority && !detonated && !JujutsuInput.IsBlocked && Input.GetMouseButtonDown(1)) { detonateInPlaceRequested = true; } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!released) { GojoSideSkillController component = ((Component)((EntityState)this).characterBody).GetComponent(); bool flag = !((EntityState)this).isAuthority || (Object.op_Implicit((Object)(object)component) && component.RedHeld); if ((((EntityState)this).isAuthority || NetworkServer.active) && flag) { overchargeEnergy = GojoStateUtils.InvestOrbOvercharge(((EntityState)this).characterBody, ((EntityState)this).fixedAge, overchargeEnergy, ((EntityState)this).isAuthority); } UpdateControlledOrb(); UpdateHoldDamage(); if (detonateInPlaceRequested) { released = true; releasedAt = ((EntityState)this).fixedAge; Detonate(); } else if (((EntityState)this).fixedAge >= 4f || (((EntityState)this).fixedAge >= 0.35f && !flag)) { Release(); } } else if (!detonated && (MoveReleasedOrb() || detonateInPlaceRequested || ((EntityState)this).fixedAge >= releasedAt + 6f)) { Detonate(); } if (detonated && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void Release() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) released = true; releasedAt = ((EntityState)this).fixedAge; Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; flightDirection = ((Vector3)(ref direction)).normalized; JujutsuSfxAssets.PlayHeavyWhoosh(orbPosition, 0.55f); } private bool MoveReleasedOrb() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) Vector3 start = orbPosition; float num = 62f * Time.fixedDeltaTime; Vector3 val = orbPosition + flightDirection * num; RaycastHit val2 = default(RaycastHit); bool flag = Physics.Linecast(orbPosition, val, ref val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && Vector3.Dot(((RaycastHit)(ref val2)).normal, flightDirection) < 0f; orbPosition = (flag ? (((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * 0.2f) : val); Vector3 contact = orbPosition; bool flag2 = !flag && GojoDamageUtility.TouchesEnemy(((BaseState)this).GetTeam(), start, orbPosition, 2.5f, out contact); if (flag2) { orbPosition = contact; } if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.SetPosition(orbPosition); orbVisual.TriggerPulse(0.1f); } if (NetworkServer.active) { DamageSphereServer(4.5f, 0.45f, 0.6f, 0.4f); } return flag || flag2; } private void UpdateHoldDamage() { holdTickStopwatch += Time.fixedDeltaTime; if (!(holdTickStopwatch < 0.3f)) { holdTickStopwatch -= 0.3f; if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.TriggerPulse(0.2f); } if (NetworkServer.active) { float overchargeFraction = OverchargeFraction; DamageSphereServer(Mathf.Lerp(4.5f, 8f, overchargeFraction), Mathf.Lerp(0.12f, 0.3f, overchargeFraction), 0.15f, Mathf.Lerp(0.25f, 0.6f, overchargeFraction)); } } } private void UpdateControlledOrb() { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) float distancePerScrollStep = JujutsuConfig.RedControlSpeed.Value * 0.18f; float scrollInput = cameraController?.ConsumeScrollInput() ?? 0f; Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; aimDirection = ((Vector3)(ref direction)).normalized; GojoOrbSync component = ((Component)((EntityState)this).characterBody).GetComponent(); if (!((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)component) && !float.IsNaN(component.ReportedDistance)) { controlDistance = component.ReportedDistance; } orbPosition = GojoStateUtils.CalculateControlledOrbPosition(((EntityState)this).characterBody.corePosition, aimRay, ref controlDistance, scrollInput, distancePerScrollStep); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)component)) { component.Report(controlDistance); } if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.SetPosition(orbPosition); orbVisual.SetRadius(Mathf.Lerp(1.15f, 3.25f, OverchargeFraction)); } } private void Detonate() { //IL_0035: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) detonated = true; CharacterBody characterBody = ((EntityState)this).characterBody; if (characterBody != null) { ((Component)characterBody).GetComponent()?.ReportResolved("Reversal Red", controlDistance, ((EntityState)this).isAuthority); } JujutsuSfxAssets.PlayHeavyWhoosh(orbPosition, 0.78f); float overchargeFraction = OverchargeFraction; float num = Mathf.Lerp(7f, 14f, overchargeFraction); if (NetworkServer.active) { DamageSphereServer(num, Mathf.Lerp(1f, 3f, overchargeFraction), 1f, Mathf.Lerp(1f, 2.5f, overchargeFraction)); } GojoEffects.Repulse(orbPosition, GojoAssets.Red, num * 1.18f, Mathf.Lerp(0.65f, 1.05f, overchargeFraction)); if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.BurstAndDestroy(num * 1.35f, Mathf.Lerp(0.3f, 0.48f, overchargeFraction)); orbVisual = null; } } private void DamageSphereServer(float radius, float damageMultiplier, float procCoefficient, float forceMultiplier) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) victims.Clear(); Collider[] array = GojoDamageUtility.OverlapEnemies(orbPosition, radius); TeamIndex team = ((BaseState)this).GetTeam(); bool crit = ((BaseState)this).RollCrit(); float damage = ((BaseState)this).damageStat * JujutsuConfig.RedDamage.Value * damageMultiplier; int num = 0; for (int i = 0; i < array.Length; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(array[i], team, victims); if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = val.body.corePosition - orbPosition; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = aimDirection; } GojoDamageUtility.ApplyDamage(((EntityState)this).gameObject, val, damage, ((Vector3)(ref val2)).normalized * 2600f * forceMultiplier + aimDirection * 900f * forceMultiplier, crit, procCoefficient, DamageTypeCombo.GenericPrimary, (DamageColorIndex)0); num++; } } GojoDamageUtility.ReportSilentPass("Reversal Red", array.Length, num, damage, orbPosition); } public override void OnExit() { if (!detonated && NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.healthComponent) && ((EntityState)this).characterBody.healthComponent.alive) { Detonate(); } CharacterBody characterBody = ((EntityState)this).characterBody; if (characterBody != null) { ((Component)characterBody).GetComponent()?.Clear(); } cameraController?.EndControl(); cameraController = null; if (Object.op_Implicit((Object)(object)orbVisual)) { orbVisual.BurstAndDestroy(0.1f, 0.15f); orbVisual = null; } ((EntityState)this).OnExit(); } public override void OnSerialize(NetworkWriter writer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnSerialize(writer); writer.Write(orbPosition); writer.Write(aimDirection); writer.Write(controlDistance); writer.Write(overchargeEnergy); } public override void OnDeserialize(NetworkReader reader) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnDeserialize(reader); orbPosition = reader.ReadVector3(); aimDirection = reader.ReadVector3(); controlDistance = reader.ReadSingle(); overchargeEnergy = reader.ReadSingle(); } public override InterruptPriority GetMinimumInterruptPriority() { if (detonated) { return (InterruptPriority)1; } return (InterruptPriority)2; } } } namespace GojoSatoruMod.Content { internal static class ContentSelfCheck { private const float DelaySeconds = 12f; internal static IEnumerator RunAfterDelay() { yield return (object)new WaitForSeconds(12f); Run(); } internal static void Run() { List list = new List(); List list2 = new List(); foreach (SkillDef skillDef in JujutsuContentPack.SkillDefs) { if (Object.op_Implicit((Object)(object)skillDef)) { Check(skillDef.skillNameToken, list); Check(skillDef.skillDescriptionToken, list); if (!Object.op_Implicit((Object)(object)skillDef.icon)) { list2.Add(skillDef.skillName ?? ""); } } } foreach (SurvivorDef survivorDef in JujutsuContentPack.SurvivorDefs) { if (Object.op_Implicit((Object)(object)survivorDef)) { Check(survivorDef.displayNameToken, list); Check(survivorDef.descriptionToken, list); Check(survivorDef.outroFlavorToken, list); } } foreach (BuffDef buff in JujutsuContentPack.Buffs) { if (Object.op_Implicit((Object)(object)buff) && !Object.op_Implicit((Object)(object)buff.iconSprite)) { list2.Add((((Object)buff).name ?? "") + " buff"); } } foreach (GameObject bodyPrefab in JujutsuContentPack.BodyPrefabs) { SkillLocator val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponent() : null); if (Object.op_Implicit((Object)(object)val) && val.passiveSkill.enabled) { Check(val.passiveSkill.skillNameToken, list); Check(val.passiveSkill.skillDescriptionToken, list); if (!Object.op_Implicit((Object)(object)val.passiveSkill.icon)) { list2.Add(((Object)bodyPrefab).name + " passive"); } } } if (list.Count == 0 && list2.Count == 0) { Plugin.Log.LogInfo((object)("Content self-check passed: " + $"{JujutsuContentPack.SkillDefs.Count} skills and " + $"{JujutsuContentPack.SurvivorDefs.Count} survivors, every " + "token resolved and every icon present.")); return; } if (list.Count > 0) { Plugin.Log.LogWarning((object)($"Content self-check: {list.Count} language " + "token(s) resolve to themselves, so the player reads the token: " + string.Join(", ", list))); } if (list2.Count > 0) { Plugin.Log.LogWarning((object)($"Content self-check: {list2.Count} icon(s) are " + "missing and will draw as blank: " + string.Join(", ", list2))); } } private static void Check(string token, List missing) { if (string.IsNullOrEmpty(token)) { missing.Add(""); return; } string text = Language.GetString(token); if (string.IsNullOrEmpty(text) || text == token) { missing.Add(token); } } } internal static class DomainMusic { internal const float ThemeDecodeSeconds = 90f; private static readonly HashSet openDomains = new HashSet(); private static NativePcmPlayer.PlaybackHandle themeHandle; private static bool musicPaused; private static bool eventResultLogged; private static readonly Dictionary resumeFrames = new Dictionary(); private static GojoAssets.DecodedAttackSound playingTheme; private static int playingFromFrame; private static float themeStartedAt; internal static float ThemeVolume => GameVolume.ThemeLevel; private static bool IsThemePlaying { get { if (themeHandle != null) { return !themeHandle.StopRequested; } return false; } } internal static void Open(object domain) { if (domain != null) { openDomains.Add(domain); } PauseGameMusic(); } private static void PauseGameMusic() { if (!musicPaused) { musicPaused = true; Post("Pause_Music"); } } private static void ResumeGameMusic() { if (musicPaused) { musicPaused = false; Post("Unpause_Music"); } } internal static void PlayTheme(GojoAssets.DecodedAttackSound theme, float volume) { if (!IsThemePlaying && theme != null && theme.Samples != null && theme.Samples.Length != 0) { int num = theme.Samples.Length / Mathf.Max(1, theme.Channels); resumeFrames.TryGetValue(theme, out var value); if (value >= num) { value = 0; } playingTheme = theme; playingFromFrame = value; themeStartedAt = Time.realtimeSinceStartup; themeHandle = NativePcmPlayer.PlayTrack(theme.Samples, theme.Channels, theme.SampleRate, volume, value); Plugin.Log.LogInfo((object)($"Domain theme from {(float)value / (float)theme.SampleRate:0.0}s " + $"of {(float)num / (float)theme.SampleRate:0.0}s decoded.")); } } private static void BankThemePosition() { if (playingTheme != null) { float num = Mathf.Max(0f, Time.realtimeSinceStartup - themeStartedAt); int num2 = Mathf.Max(1, playingTheme.Channels); int num3 = playingTheme.Samples.Length / num2; int num4 = playingFromFrame + Mathf.RoundToInt(num * (float)playingTheme.SampleRate); resumeFrames[playingTheme] = Mathf.Clamp(num4, 0, num3); playingTheme = null; } } private static void StopTheme() { BankThemePosition(); themeHandle?.RequestStop(); themeHandle = null; } internal static void Stop(object domain) { if (domain != null) { openDomains.Remove(domain); } if (openDomains.Count <= 0) { StopTheme(); ResumeGameMusic(); } } internal static void StopAll() { openDomains.Clear(); StopTheme(); ResumeGameMusic(); } private static void Post(string eventName) { uint num = AkSoundEngine.PostEvent(eventName, Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).gameObject : null); if (!eventResultLogged) { eventResultLogged = true; Plugin.Log.LogInfo((object)("Domain music: " + eventName + " returned playing id " + $"{num}" + ((num == 0) ? " (invalid — the music bus was not paused)." : "."))); } } } internal static class GameVolume { private const string MasterConVar = "volume_master"; private const string SfxConVar = "volume_sfx"; private const string MusicConVar = "volume_music"; private const float PercentageThreshold = 1.5f; private static bool logged; internal static float Sfx => Read("volume_master") * Read("volume_sfx"); internal static float Music => Read("volume_master") * Read("volume_music"); private static float ModScale { get { if (JujutsuConfig.ModVolume == null) { return 1f; } return Mathf.Max(0f, JujutsuConfig.ModVolume.Value); } } private static bool Follows { get { if (JujutsuConfig.FollowGameVolume != null) { return JujutsuConfig.FollowGameVolume.Value; } return true; } } internal static float VoiceLevel { get { if (JujutsuConfig.VoiceVolume == null) { return 0.1f; } return Mathf.Max(0f, JujutsuConfig.VoiceVolume.Value); } } internal static float ThemeLevel { get { if (JujutsuConfig.ThemeVolume == null) { return 0.05f; } return Mathf.Max(0f, JujutsuConfig.ThemeVolume.Value); } } private static void LogOnce() { if (!logged) { logged = true; Plugin.Log.LogInfo((object)($"Mod audio: volume {ModScale:0.##}, voices {VoiceLevel:0.##}, " + $"themes {ThemeLevel:0.##}, " + "game sliders " + (Follows ? "followed" : "ignored") + ".")); if (Follows) { Plugin.Log.LogInfo((object)("Game volume sliders: " + string.Format("{0}='{1}' -> {2:0.##}, ", "volume_master", Raw("volume_master") ?? "", Read("volume_master")) + string.Format("{0}='{1}' -> {2:0.##}, ", "volume_sfx", Raw("volume_sfx") ?? "", Read("volume_sfx")) + string.Format("{0}='{1}' -> {2:0.##}. ", "volume_music", Raw("volume_music") ?? "", Read("volume_music")) + "An absent slider is treated as full, so the mod stays audible rather than silently muting itself if the console changes. " + $"Effects land at {Sfx * ModScale:0.###} of what each sound " + $"was mixed at; a voice line at {VoiceLevel:0.##} therefore " + $"plays at {VoiceLevel * Sfx * ModScale:0.###}.")); } } } internal static float ScaleSfx(float volume) { LogOnce(); return volume * ModScale * (Follows ? Sfx : 1f); } internal static float ScaleMusic(float volume) { LogOnce(); return volume * ModScale * (Follows ? Music : 1f); } private static string Raw(string name) { try { Console instance = Console.instance; BaseConVar obj = (((Object)(object)instance != (Object)null) ? instance.FindConVar(name) : null); return (obj != null) ? obj.GetString() : null; } catch (Exception ex) { if (!logged) { Plugin.Log.LogWarning((object)("Could not read " + name + " from the console, so mod audio stays at its own volume: " + ex.Message)); } return null; } } private static float Read(string name) { string text = Raw(name); if (string.IsNullOrEmpty(text) || !float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 1f; } if (result > 1.5f) { result /= 100f; } return Mathf.Clamp01(result); } } internal static class GojoAssets { internal sealed class DecodedAttackSound { internal string Name; internal float[] Samples; internal int Channels; internal int SampleRate; internal int FrameCount; internal float LastPlaybackTime = -1000f; internal float Peak; internal bool ReportedGain; internal float Duration { get { if (SampleRate <= 0) { return 0f; } return (float)FrameCount / (float)SampleRate; } } } private enum IconPattern { Ring, Burst, Collapse, Beam } private static float nextVoiceAllowedTime = -1000f; internal static readonly Color Red = new Color(1f, 0.08f, 0.08f, 1f); internal static readonly Color Blue = new Color(0.05f, 0.45f, 1f, 1f); internal static readonly Color Infinity = new Color(0.65f, 0.95f, 1f, 1f); internal static readonly Color Purple = new Color(0.65f, 0.08f, 1f, 1f); internal static readonly Color DomainVoid = new Color(0.2f, 0.035f, 0.42f, 1f); internal static readonly Color DomainGlow = new Color(0.52f, 0.18f, 1f, 1f); internal static readonly Color DomainStar = new Color(0.8f, 0.64f, 1f, 1f); private static readonly HashSet favouredVoiceFiles = new HashSet(StringComparer.OrdinalIgnoreCase) { "gojo-voice2", "sukuna-laugh", "sukuna-laugh2", "your-weak" }; private const float FavouredVoiceWeight = 2.5f; private const float LoudnessTarget = 0.14f; private const float SilenceFloor = 0.01f; private const float LimitKnee = 0.8f; private const float MaximumNormalisation = 12f; private static readonly List generatedIcons = new List(); private static readonly List drawnIcons = new List(); internal static Sprite PassiveIcon { get; private set; } internal static Sprite RedIcon { get; private set; } internal static Sprite BlueIcon { get; private set; } internal static Sprite InfinityIcon { get; private set; } internal static Sprite PurpleIcon { get; private set; } internal static Sprite FistIcon { get; private set; } internal static Sprite KickIcon { get; private set; } internal static Sprite DomainIcon { get; private set; } internal static Sprite ReverseCursedIcon { get; private set; } internal static Sprite DashIcon { get; private set; } internal static Texture2D Portrait { get; private set; } internal static DecodedAttackSound RedSound { get; private set; } internal static DecodedAttackSound BlueSound { get; private set; } internal static DecodedAttackSound PurpleSound { get; private set; } internal static DecodedAttackSound DomainSound { get; private set; } internal static DecodedAttackSound DomainTheme { get; private set; } internal static DecodedAttackSound SpawnVoice { get; private set; } internal static DecodedAttackSound[] VoiceLines { get; private set; } internal static void Initialize() { PassiveIcon = LoadIcon("gojo-infinity", () => CreateIcon("texGojoPassive", Infinity, Color.white, IconPattern.Ring)); RedIcon = LoadIcon("gojo-red", () => CreateIcon("texGojoRed", Red, new Color(1f, 0.55f, 0.15f), IconPattern.Burst)); BlueIcon = LoadIcon("gojo-blue", () => CreateIcon("texGojoBlue", Blue, Color.cyan, IconPattern.Collapse)); InfinityIcon = LoadIcon("gojo-infinity", () => CreateIcon("texGojoInfinity", Infinity, Color.white, IconPattern.Ring)); PurpleIcon = LoadIcon("gojo-purple", () => CreateIcon("texGojoPurple", Purple, new Color(1f, 0.25f, 0.75f), IconPattern.Ring)); FistIcon = LoadIcon("gojo-fist", () => CreateIcon("texGojoFist", new Color(0.08f, 0.1f, 0.16f), Infinity, IconPattern.Burst)); KickIcon = LoadIcon("gojo-kick", () => CreateIcon("texGojoKick", new Color(0.12f, 0.08f, 0.18f), Color.white, IconPattern.Burst)); ReverseCursedIcon = LoadIcon("gojo-rct", () => CreateIcon("texGojoReverseCursed", Red, Color.white, IconPattern.Ring)); DashIcon = LoadIcon("gojo-dash", () => CreateIcon("texGojoDash", Blue, Color.white, IconPattern.Beam)); DomainIcon = LoadIcon("gojo-domain", () => CreateIcon("texGojoDomain", new Color(0.04f, 0.01f, 0.12f), Purple, IconPattern.Ring)); Portrait = LoadPersistentTexture("ui/gojo-portrait.png", "texGojoPortrait") ?? CreatePortrait(); PreparePersistentTexture(Portrait); } internal static IEnumerator LoadAttackSounds() { RedSound = LoadSound("red.mp3", 0.2f); yield return null; BlueSound = LoadSound("blue.mp3"); yield return null; PurpleSound = LoadSound("purple.mp3"); yield return null; DomainSound = LoadSound("domain.mp3", 0.2f); DomainTheme = LoadSound("gojo-domain-theme.mp3", 1f, "Gojo", 90f); yield return null; SpawnVoice = LoadSound("gojo-voice1.mp3", 0.7f); string[] voiceFiles = new string[4] { "gojo-voice2.mp3", "gojo-voice8.mp3", "gojo-voice9.mp3", "your-weak.mp3" }; DecodedAttackSound[] voices = new DecodedAttackSound[voiceFiles.Length]; for (int i = 0; i < voiceFiles.Length; i++) { voices[i] = LoadSound(voiceFiles[i], 0.55f); yield return null; } VoiceLines = voices; } internal static DecodedAttackSound PickVoice(DecodedAttackSound[] candidates) { if (candidates == null || candidates.Length == 0) { return null; } float num = 0f; for (int i = 0; i < candidates.Length; i++) { num += VoiceWeight(candidates[i]); } if (num <= 0f) { return null; } float num2 = Random.value * num; for (int j = 0; j < candidates.Length; j++) { float num3 = VoiceWeight(candidates[j]); if (!(num3 <= 0f)) { num2 -= num3; if (num2 <= 0f) { return candidates[j]; } } } for (int num4 = candidates.Length - 1; num4 >= 0; num4--) { if (VoiceWeight(candidates[num4]) > 0f) { return candidates[num4]; } } return null; } private static float VoiceWeight(DecodedAttackSound sound) { if (sound == null) { return 0f; } if (!IsFavouredVoice(sound)) { return 1f; } return 2.5f; } private static bool IsFavouredVoice(DecodedAttackSound sound) { string name = sound.Name; if (string.IsNullOrEmpty(name)) { return false; } int num = name.IndexOf('_'); return favouredVoiceFiles.Contains((num >= 0) ? name.Substring(num + 1) : name); } internal static void TryPlayVoice(Vector3 position, float chance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (VoiceLines != null && VoiceLines.Length != 0 && !(Time.realtimeSinceStartup < nextVoiceAllowedTime) && !(Random.value > Mathf.Clamp01(chance))) { DecodedAttackSound decodedAttackSound = PickVoice(VoiceLines); if (decodedAttackSound != null) { PlayAttackSound(decodedAttackSound, position, 1f, 0f, "Gojo", spokenLine: true); nextVoiceAllowedTime = Time.realtimeSinceStartup + 22f; } } } internal static void SuppressVoiceFor(float seconds) { nextVoiceAllowedTime = Mathf.Max(nextVoiceAllowedTime, Time.realtimeSinceStartup + seconds); } internal static NativePcmPlayer.PlaybackHandle PlayAttackSound(DecodedAttackSound sound, Vector3 position, float volume = 0.9f, float minimumInterval = 0f, string ownerName = "Gojo", bool spokenLine = false) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ac: Unknown result type (might be due to invalid IL or missing references) if (sound == null || sound.Samples == null || sound.Samples.Length == 0) { return null; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (minimumInterval > 0f && realtimeSinceStartup - sound.LastPlaybackTime < minimumInterval) { return null; } float num = 1f; float pan = 0f; Camera main = Camera.main; if (Object.op_Implicit((Object)(object)main)) { Vector3 val = position - ((Component)main).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 4f) { num = Mathf.Pow(Mathf.Clamp01(1f - (magnitude - 4f) / 71f), 0.65f); } if (magnitude > 0.01f) { pan = Mathf.Clamp(Vector3.Dot(((Component)main).transform.right, val / magnitude), -1f, 1f); } } float num2 = Mathf.Max(0f, volume) * num; if (!sound.ReportedGain) { sound.ReportedGain = true; Plugin.Log.LogInfo((object)($"{sound.Name} first play: peak {sound.Peak:0.###}" + $" x level {volume:0.###}" + $" x distance {num:0.###}" + $" x mod/game {GameVolume.ScaleSfx(1f):0.###}" + $" = {sound.Peak * num2 * GameVolume.ScaleSfx(1f):0.####}" + " of full scale. Below about 0.05 is inaudible over the game; if the peak itself is small the file is quiet and no setting will fix it.")); } NativePcmPlayer.PlaybackHandle result = NativePcmPlayer.Play(sound.Samples, sound.Channels, sound.SampleRate, num2, pan, spokenLine); sound.LastPlaybackTime = realtimeSinceStartup; return result; } internal static NativePcmPlayer.PlaybackHandle PlayRandomSound(DecodedAttackSound[] sounds, Vector3 position, float volume, float minimumInterval = 0f, string ownerName = "Jujutsu") { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (sounds == null || sounds.Length == 0) { return null; } int num = Random.Range(0, sounds.Length); for (int i = 0; i < sounds.Length; i++) { DecodedAttackSound decodedAttackSound = sounds[(num + i) % sounds.Length]; if (decodedAttackSound != null) { return PlayAttackSound(decodedAttackSound, position, volume, minimumInterval, ownerName); } } return null; } internal static DecodedAttackSound MakeLoopable(DecodedAttackSound source, float skipSeconds, float lengthSeconds, float fadeSeconds) { if (source == null || source.Samples == null || source.Channels <= 0 || source.SampleRate <= 0) { return source; } int channels = source.Channels; int num = source.Samples.Length / channels; int num2 = Mathf.Clamp(Mathf.RoundToInt(skipSeconds * (float)source.SampleRate), 0, Mathf.Max(0, num - 1)); int num3 = Mathf.Min(Mathf.RoundToInt(lengthSeconds * (float)source.SampleRate), num - num2); if (num3 <= 0) { return source; } int num4 = Mathf.Clamp(Mathf.RoundToInt(fadeSeconds * (float)source.SampleRate), 0, num3 / 2); float[] array = new float[num3 * channels]; for (int i = 0; i < num3; i++) { float num5 = 1f; if (num4 > 0) { if (i < num4) { num5 = Mathf.Sqrt((float)i / (float)num4); } else if (i >= num3 - num4) { num5 = Mathf.Sqrt((float)(num3 - i) / (float)num4); } } int num6 = (num2 + i) * channels; int num7 = i * channels; for (int j = 0; j < channels; j++) { array[num7 + j] = source.Samples[num6 + j] * num5; } } return new DecodedAttackSound { Name = source.Name + " (loop)", Samples = array, Channels = channels, SampleRate = source.SampleRate, FrameCount = num3 }; } private static float Loudness(float[] samples) { if (samples == null || samples.Length == 0) { return 0f; } int[] array = new int[512]; int num = 0; for (int i = 0; i < samples.Length; i++) { float num2 = ((samples[i] < 0f) ? (0f - samples[i]) : samples[i]); if (!(num2 < 0.01f)) { int num3 = (int)(num2 * 512f); if (num3 >= 512) { num3 = 511; } array[num3]++; num++; } } if (num == 0) { return 0f; } float num4 = (float)num * 0.75f; int num5 = 0; for (int j = 0; j < 512; j++) { num5 += array[j]; if ((float)num5 >= num4) { return ((float)j + 0.5f) / 512f; } } return 1f; } private static float Limit(float sample) { float num = ((sample < 0f) ? (0f - sample) : sample); if (num <= 0.8f) { return sample; } float num2 = num - 0.8f; float num3 = 0.19999999f; float num4 = 0.8f + num3 * (num2 / (num2 + num3)); if (!(sample < 0f)) { return num4; } return 0f - num4; } private static float Peak(float[] samples) { float num = 0f; for (int i = 0; i < samples.Length; i++) { float num2 = ((samples[i] < 0f) ? (0f - samples[i]) : samples[i]); if (num2 > num) { num = num2; } } return num; } internal static DecodedAttackSound LoadSound(string fileName, float gain = 1f, string ownerName = "Gojo", float maxSeconds = 0f) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown string text = JujutsuAssetPaths.Find("assets", fileName); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)(ownerName + " sound was not found: " + text)); return null; } try { float[] samples; int channels; int sampleRate; if (string.Equals(Path.GetExtension(text), ".wav", StringComparison.OrdinalIgnoreCase)) { DecodeWave(text, out samples, out channels, out sampleRate); } else { MpegFile val = new MpegFile(text); try { channels = val.Channels; sampleRate = val.SampleRate; float[] array = new float[16384]; List list = new List(sampleRate * channels * 4); int num = ((maxSeconds > 0f) ? Mathf.CeilToInt(maxSeconds * (float)sampleRate * (float)channels) : int.MaxValue); int num2; while (list.Count < num && (num2 = val.ReadSamples(array, 0, array.Length)) > 0) { int num3 = Mathf.Min(num2, num - list.Count); for (int i = 0; i < num3; i++) { list.Add(array[i]); } } samples = list.ToArray(); } finally { ((IDisposable)val)?.Dispose(); } } int num4 = ((channels > 0) ? (samples.Length / channels) : 0); if (channels <= 0 || sampleRate <= 0 || num4 <= 0) { Plugin.Log.LogError((object)("Gojo attack sound " + fileName + " decoded without PCM samples.")); return null; } DecodedAttackSound decodedAttackSound = new DecodedAttackSound { Name = "snd" + ownerName + "_" + Path.GetFileNameWithoutExtension(fileName), Samples = samples, Channels = channels, SampleRate = sampleRate, FrameCount = num4 }; float num5 = Peak(decodedAttackSound.Samples); float num6 = Loudness(decodedAttackSound.Samples); float num7 = 1f; if ((JujutsuConfig.NormaliseSounds == null || JujutsuConfig.NormaliseSounds.Value) && num6 > 0.0005f) { num7 = Mathf.Min(0.14f / num6, 12f); } float num8 = Mathf.Clamp01(gain) * 1.15f * num7; float[] array2 = new float[decodedAttackSound.Samples.Length]; for (int j = 0; j < array2.Length; j++) { array2[j] = Limit(decodedAttackSound.Samples[j] * num8); } decodedAttackSound.Samples = array2; decodedAttackSound.Peak = Peak(decodedAttackSound.Samples); Plugin.Log.LogInfo((object)("Decoded " + ownerName + " PCM " + fileName + ": " + $"{decodedAttackSound.Duration:F2}s, {channels}ch, {sampleRate}Hz, " + $"{decodedAttackSound.Samples.Length} samples, gain {gain:P0}, " + $"source peak {num5:0.###} loudness " + $"{num6:0.####} x{num7:0.##} " + $"-> peak {decodedAttackSound.Peak:0.###} loudness " + $"{Loudness(decodedAttackSound.Samples):0.####}.")); return decodedAttackSound; } catch (Exception arg) { Plugin.Log.LogError((object)("Could not decode " + ownerName + " sound " + $"{fileName}: {arg}")); return null; } } internal static Texture2D LoadPersistentTexture(string relativePath, string textureName) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown string text = JujutsuAssetPaths.Find("assets", relativePath.Replace('/', Path.DirectorySeparatorChar)); if (!File.Exists(text)) { Plugin.Log.LogWarning((object)("Persistent portrait was not found: " + text)); return null; } try { Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text), true)) { Object.Destroy((Object)(object)val); Plugin.Log.LogWarning((object)("Persistent portrait could not be decoded: " + text)); return null; } ((Object)val).name = textureName; PreparePersistentTexture(val); Plugin.Log.LogInfo((object)("Loaded persistent portrait " + relativePath + ": " + $"{((Texture)val).width}x{((Texture)val).height}.")); return val; } catch (Exception ex) { Plugin.Log.LogError((object)("Could not load persistent portrait " + text + ": " + ex)); return null; } } internal static void PreparePersistentSprite(Sprite sprite) { if (Object.op_Implicit((Object)(object)sprite)) { ((Object)sprite).hideFlags = (HideFlags)32; } } internal static void PreparePersistentTexture(Texture2D texture) { if (Object.op_Implicit((Object)(object)texture)) { ((Texture)texture).wrapMode = (TextureWrapMode)1; ((Texture)texture).filterMode = (FilterMode)1; ((Texture)texture).anisoLevel = 1; ((Object)texture).hideFlags = (HideFlags)32; } } private static void DecodeWave(string path, out float[] samples, out int channels, out int sampleRate) { using FileStream fileStream = File.OpenRead(path); using BinaryReader binaryReader = new BinaryReader(fileStream); string text = Encoding.ASCII.GetString(binaryReader.ReadBytes(4)); binaryReader.ReadInt32(); string text2 = Encoding.ASCII.GetString(binaryReader.ReadBytes(4)); if (text != "RIFF" || text2 != "WAVE") { throw new InvalidDataException("Invalid RIFF/WAVE header."); } short num = 0; short num2 = 0; channels = 0; sampleRate = 0; byte[] array = null; while (fileStream.Position + 8 <= fileStream.Length) { string text3 = Encoding.ASCII.GetString(binaryReader.ReadBytes(4)); int num3 = binaryReader.ReadInt32(); long num4 = fileStream.Position + num3 + (num3 & 1); if (num3 < 0 || num4 > fileStream.Length + 1) { throw new InvalidDataException("Invalid WAVE chunk size."); } if (text3 == "fmt ") { num = binaryReader.ReadInt16(); channels = binaryReader.ReadInt16(); sampleRate = binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt16(); num2 = binaryReader.ReadInt16(); } else if (text3 == "data") { array = binaryReader.ReadBytes(num3); } fileStream.Position = Math.Min(num4, fileStream.Length); } if (array == null || channels <= 0 || sampleRate <= 0) { throw new InvalidDataException("WAVE format or data chunk is missing."); } int num5 = num2 / 8; if ((num != 1 && num != 3) || (num2 != 8 && num2 != 16 && num2 != 24 && num2 != 32) || num5 <= 0) { throw new InvalidDataException($"Unsupported WAVE format {num}/{num2}-bit."); } int num6 = array.Length / num5; samples = new float[num6]; for (int i = 0; i < num6; i++) { int num7 = i * num5; if (num == 3 && num2 == 32) { samples[i] = BitConverter.ToSingle(array, num7); continue; } switch (num2) { case 8: samples[i] = ((float)(int)array[num7] - 128f) / 128f; break; case 16: samples[i] = (float)BitConverter.ToInt16(array, num7) / 32768f; break; case 24: { int num9 = array[num7] | (array[num7 + 1] << 8) | (array[num7 + 2] << 16); if ((num9 & 0x800000) != 0) { num9 |= -16777216; } samples[i] = (float)num9 / 8388608f; break; } default: { int num8 = BitConverter.ToInt32(array, num7); samples[i] = (float)num8 / 2.1474836E+09f; break; } } } } internal static void ReportSkillIcons() { StringBuilder stringBuilder = new StringBuilder(); int num = 0; foreach (SkillDef skillDef in JujutsuContentPack.SkillDefs) { if (Object.op_Implicit((Object)(object)skillDef)) { if (stringBuilder.Length > 0) { stringBuilder.Append(", "); } if (!Object.op_Implicit((Object)(object)skillDef.icon)) { num++; stringBuilder.Append(skillDef.skillName + "=NONE"); } else { stringBuilder.Append(skillDef.skillName + "=" + ((Object)skillDef.icon).name); } } } Plugin.Log.LogInfo((object)($"Skill icons in use ({num} with none at all): " + stringBuilder)); } internal static void ReportIconSources() { if (generatedIcons.Count == 0) { Plugin.Log.LogInfo((object)$"Skill icons: all {drawnIcons.Count} drawn from files."); return; } generatedIcons.Sort(StringComparer.Ordinal); Plugin.Log.LogWarning((object)($"Skill icons: {drawnIcons.Count} from files, " + $"{generatedIcons.Count} generated in code because no art was " + "found for them — " + string.Join(", ", generatedIcons) + ". Files go in assets/runtime/ui/icons as .png.")); } internal static Sprite LoadIcon(string fileName, Func fallback) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = LoadPersistentTexture("ui/icons/" + fileName + ".png", "tex" + fileName); if (!Object.op_Implicit((Object)(object)val)) { generatedIcons.Add(fileName); return fallback(); } drawnIcons.Add(fileName); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)obj).name = "sprite" + fileName; PreparePersistentSprite(obj); return obj; } internal static Sprite CreateSkinIcon(string name, Color primary, Color secondary) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return CreateIcon(name, primary, secondary, IconPattern.Ring); } private static Sprite CreateIcon(string name, Color primary, Color secondary, IconPattern pattern) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); ((Object)val).name = name; ((Texture)val).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[16384]; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(63.5f, 63.5f); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { Vector2 val3 = (new Vector2((float)j, (float)i) - val2) / 64f; float magnitude = ((Vector2)(ref val3)).magnitude; float num = Mathf.Atan2(val3.y, val3.x); float num2 = 0f; float num3 = 0f; switch (pattern) { case IconPattern.Ring: num2 = Mathf.Clamp01(1f - Mathf.Abs(magnitude - 0.52f) * 10f); num2 = Mathf.Max(num2, Mathf.Clamp01(1f - magnitude * 3.5f)); num3 = Mathf.Clamp01(1f - magnitude); break; case IconPattern.Burst: { float num7 = Mathf.Abs(Mathf.Sin(num * 7f)); num2 = Mathf.Clamp01((1f - magnitude) * 1.7f + num7 * 0.28f - 0.15f); num3 = Mathf.Clamp01(magnitude); break; } case IconPattern.Collapse: { float num6 = Mathf.Abs(Mathf.Sin(num * 3f + magnitude * 12f)); num2 = Mathf.Clamp01((1f - magnitude) * 1.25f + num6 * 0.35f - 0.18f); num3 = Mathf.Clamp01(1f - magnitude); break; } case IconPattern.Beam: { float num4 = Mathf.Clamp01(1f - Mathf.Abs(val3.y) * 5f); float num5 = Mathf.Clamp01(1f - magnitude * 2.6f); num2 = Mathf.Clamp01(Mathf.Max(num4 * (1f - Mathf.Abs(val3.x) * 0.5f), num5)); num3 = num5; break; } } Color val4 = Color.Lerp(primary, secondary, num3); val4.a = num2 * Mathf.Clamp01((1.08f - magnitude) * 7f); array[i * 128 + j] = val4; } } val.SetPixels(array); val.Apply(false, true); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); PreparePersistentSprite(obj); return obj; } private static Texture2D CreatePortrait() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_013c: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false); ((Object)val).name = "texGojoPortrait"; Color[] array = (Color[])(object)new Color[65536]; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(128f, 133.12f); for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { Vector2 val3 = (new Vector2((float)j, (float)i) - val2) / 256f; float num = Mathf.Clamp01(1.1f - ((Vector2)(ref val3)).magnitude * 2.1f); Vector2 val4 = new Vector2(val3.x / 0.19f, val3.y / 0.28f); float num2 = Mathf.Clamp01(1f - ((Vector2)(ref val4)).magnitude); float num3 = num2 * Mathf.Clamp01(1f - Mathf.Abs(val3.y - 0.03f) * 45f); float num4 = Mathf.Clamp01(num2 * (val3.y + 0.04f) * 12f); Color val5 = Color.Lerp(new Color(0.015f, 0.025f, 0.07f), new Color(0.04f, 0.18f, 0.3f), num); val5 = Color.Lerp(val5, new Color(0.78f, 0.88f, 0.94f), num4); val5 = Color.Lerp(val5, new Color(0.01f, 0.015f, 0.025f), num3); val5.a = 1f; array[i * 256 + j] = val5; } } val.SetPixels(array); val.Apply(false, true); PreparePersistentTexture(val); return val; } } internal static class GojoLanguage { internal const string Prefix = "CODEX_GOJO_"; internal static void Register() { AddText(); LogResolvedNumbers(); } private static void AddText() { LanguageAPI.Add("CODEX_GOJO_NAME", "Satoru Gojo"); LanguageAPI.Add("CODEX_GOJO_SUBTITLE", "The Strongest Sorcerer"); LanguageAPI.Add("CODEX_GOJO_DESCRIPTION", "Satoru Gojo controls space itself. Recover with Reverse Cursed Technique, gather enemies with Blue, then erase them with Hollow Purple."); LanguageAPI.Add("CODEX_GOJO_OUTRO_FLAVOR", "..and so he left, still untouchable."); LanguageAPI.Add("CODEX_GOJO_OUTRO_FAILURE", "..and so he vanished, infinity finally crossed."); LanguageAPI.Add("CODEX_GOJO_PASSIVE_NAME", "Six Eyes — Infinity"); LanguageAPI.Add("CODEX_GOJO_PASSIVE_DESCRIPTION", "Gain " + StatText.Healing(StatText.Number(20f) + " armor") + " and " + StatText.Damage(StatText.Number(15f) + "% base critical chance") + ". " + StatText.Utility("Infinity") + " slows enemies within " + StatText.Utility(StatText.Metres(16f)) + ", more heavily the closer they get. Regenerate barrier every second, up to " + StatText.Fraction(JujutsuConfig.BarrierCap.Value) + " of maximum health. Cursed Energy slowly regenerates; melee hits restore " + StatText.Number(9f) + " energy, the last blow of the combo " + StatText.Number(14f) + ", and kills restore " + StatText.Number(18f) + ". " + StatText.Utility("Jump, release, then press Jump again in the air to fly. Flight consumes " + StatText.Number(4f) + " energy per second. Jump ascends, Sprint descends; double-tap Jump to cancel flight") + "."); LanguageAPI.Add("CODEX_GOJO_SKIN_DEFAULT_NAME", "Jujutsu High"); LanguageAPI.Add("CODEX_GOJO_SKIN_SUMMER_NAME", "Beach Day"); LanguageAPI.Add("CODEX_GOJO_SKIN_SUIT_NAME", "Formal"); LanguageAPI.Add("CODEX_GOJO_SKIN_SHINJUKU_NAME", "Shinjuku Showdown"); LanguageAPI.Add("CODEX_GOJO_SKIN_SHINJUKUBARE_NAME", "Shinjuku, Coatless"); LanguageAPI.Add("CODEX_GOJO_JAB_NAME", "Hand-to-Hand Combat"); LanguageAPI.Add("CODEX_GOJO_JAB_DESCRIPTION", "A three-swing combo that borrows from Limitless: the first " + StatText.Utility("hauls everything within " + StatText.Metres(11.1f) + " toward you") + " for " + StatText.Damage(StatText.Percent(2.2f) + " damage") + ", the second " + StatText.Utility("lands where it stands") + " for " + StatText.Damage(StatText.Percent(2.5f)) + ", and the third " + StatText.Utility("drives it away") + " for " + StatText.Damage(StatText.Percent(5.2f)) + ". A hit restores " + StatText.Utility(StatText.Number(9f) + " Cursed Energy") + ", and the blow that ends the combo " + StatText.Utility(StatText.Number(14f)) + "."); LanguageAPI.Add("CODEX_GOJO_KICK_NAME", "Spinning Kick"); LanguageAPI.Add("CODEX_GOJO_KICK_DESCRIPTION", "Perform a full spinning kick which strikes every enemy within " + StatText.Utility(StatText.Metres(6f)) + " for " + StatText.Damage(StatText.Percent(7.5f) + " damage") + " and launches them away. A successful kick restores " + StatText.Utility(StatText.Number(12f) + " Cursed Energy") + "."); LanguageAPI.Add("CODEX_GOJO_RED_NAME", "Cursed Technique Reversal: Red"); LanguageAPI.Add("CODEX_GOJO_RED_DESCRIPTION", StatText.Utility("Mouse4.") + " Release Red from Gojo. Hold to steer it with free horizontal and vertical aim; use the mouse wheel to change its distance. It damages and pushes nearby enemies as it moves. Release to hurl it: it flies until it strikes an enemy or a wall, and " + StatText.Utility("right click detonates it early") + ", in hand or in flight. The burst deals " + StatText.Damage(StatText.Percent(JujutsuConfig.RedDamage.Value) + " damage") + " across " + StatText.Utility(StatText.Metres(7f)) + " with violent knockback. After " + StatText.Number(1f) + " second, holding invests up to " + StatText.Utility(StatText.Number(50f) + " additional Cursed Energy") + ": the sphere grows, and the explosion scales up to " + StatText.Damage(StatText.Percent(JujutsuConfig.RedDamage.Value * 3f) + " damage") + " across " + StatText.Utility(StatText.Metres(14f)) + " with stronger knockback. " + StatText.Utility("Base cost: " + StatText.Number(26f) + " Cursed Energy.") + " " + StatText.Utility(StatText.Seconds(JujutsuConfig.RedCooldown.Value) + " second cooldown.")); LanguageAPI.Add("CODEX_GOJO_BLUE_NAME", "Cursed Technique Lapse: Blue"); LanguageAPI.Add("CODEX_GOJO_BLUE_DESCRIPTION", StatText.Utility("Mouse5.") + " Release Blue from Gojo. Hold to steer it with free horizontal and vertical aim; use the mouse wheel to change its distance. It pulls and damages enemies while moving. Release to create a " + StatText.Number(2.4f) + " second collapse. After " + StatText.Number(1f) + " second, holding invests up to " + StatText.Utility(StatText.Number(50f) + " additional Cursed Energy") + ", increasing its size, damage, collapse radius and pulling force. " + StatText.Utility("Base cost: " + StatText.Number(22f) + " Cursed Energy.") + " " + StatText.Utility(StatText.Seconds(JujutsuConfig.BlueCooldown.Value) + " second cooldown.")); LanguageAPI.Add("CODEX_GOJO_INFINITY_NAME", "Reverse Cursed Technique"); LanguageAPI.Add("CODEX_GOJO_INFINITY_DESCRIPTION", StatText.Healing("Restore " + StatText.Fraction(JujutsuConfig.HealingFraction.Value) + " maximum health") + " over " + StatText.Number(JujutsuConfig.HealingDuration.Value) + " seconds. Gojo remains stationary while healing. " + StatText.Utility("Costs " + StatText.Number(25f) + " Cursed Energy.") + " " + StatText.Utility(StatText.Seconds(JujutsuConfig.HealingCooldown.Value) + " second cooldown.")); LanguageAPI.Add("CODEX_GOJO_DASH_NAME", "Instant Transmission"); LanguageAPI.Add("CODEX_GOJO_DASH_DESCRIPTION", "Aimed at an enemy within " + StatText.Utility(StatText.Metres(34f)) + ", step instantly " + StatText.Utility("behind them") + " and set off a Red against their back for " + StatText.Damage(StatText.Percent(16f) + " damage") + " across " + StatText.Utility(StatText.Metres(7.5f)) + ". Everything caught is " + StatText.Utility("thrown regardless of its weight") + ", and anything left under " + StatText.Damage(StatText.Fraction(0.25f) + " health") + " is killed outright. Aimed at nothing, he is carried " + StatText.Utility(StatText.Metres(19f)) + " forward instead. " + StatText.Utility("Costs " + StatText.Number(6f) + " Cursed Energy.") + " " + StatText.Utility(StatText.Seconds(JujutsuConfig.DashCooldown.Value) + " second cooldown.")); LanguageAPI.Add("CODEX_GOJO_PURPLE_NAME", "Imaginary Technique: Hollow Purple"); LanguageAPI.Add("CODEX_GOJO_PURPLE_DESCRIPTION", StatText.Utility("Charge for up to " + StatText.Number(6f) + " seconds while Red and Blue merge into Purple") + ", then release a gigantic piercing sphere. It cuts everything it crosses within " + StatText.Utility(StatText.Metres(5.5f)) + " for " + StatText.Damage(StatText.Percent(JujutsuConfig.PurpleDamage.Value) + " damage, scaling to " + StatText.Percent(JujutsuConfig.PurpleDamage.Value * JujutsuConfig.PurpleChargedDamageMultiplier.Value) + " at full charge") + ", then detonates across " + StatText.Utility(StatText.Metres(24f)) + ". " + StatText.Utility("Costs " + StatText.Fraction(0.63f) + " of maximum Cursed Energy to release at the earliest, rising to the whole pool at a full charge.") + " " + StatText.Damage(StatText.Seconds(JujutsuConfig.PurpleCooldown.Value) + " second cooldown.")); LanguageAPI.Add("CODEX_GOJO_DOMAIN_NAME", "Domain Expansion: Unlimited Void"); LanguageAPI.Add("CODEX_GOJO_DOMAIN_DESCRIPTION", StatText.Utility("Press T.") + " Remain completely stationary during the cast — on the ground or in the air — then expand a " + StatText.Metres(32f) + " domain for " + StatText.Number(13f) + " seconds. Enemies inside are repeatedly stunned and damaged. " + StatText.Utility("Costs " + StatText.Fraction(JujutsuConfig.DomainEnergyFraction.Value) + " of maximum Cursed Energy.") + " " + StatText.Damage(StatText.Seconds(JujutsuConfig.DomainCooldown.Value) + " second cooldown.")); } private static void LogResolvedNumbers() { Plugin.Log.LogInfo((object)"Gojo skill text assembled from live values:"); Plugin.Log.LogInfo((object)(" passive : armour " + StatText.Number(20f) + ", crit " + StatText.Number(15f) + "%, infinity " + StatText.Metres(16f) + ", barrier cap " + StatText.Fraction(JujutsuConfig.BarrierCap.Value) + ", melee +" + StatText.Number(9f) + ", finisher +" + StatText.Number(14f) + ", kill +" + StatText.Number(18f) + ", flight " + StatText.Number(4f) + "/s")); Plugin.Log.LogInfo((object)(" jab : " + StatText.Percent(2.2f) + " / " + StatText.Percent(2.5f) + " / " + StatText.Percent(5.2f) + ", pull reach " + StatText.Metres(11.1f))); Plugin.Log.LogInfo((object)(" kick : " + StatText.Percent(7.5f) + " across " + StatText.Metres(6f) + ", restores " + StatText.Number(12f))); Plugin.Log.LogInfo((object)(" red : " + StatText.Percent(JujutsuConfig.RedDamage.Value) + " -> " + StatText.Percent(JujutsuConfig.RedDamage.Value * 3f) + ", " + StatText.Metres(7f) + " -> " + StatText.Metres(14f) + ", cost " + StatText.Number(26f) + ", cooldown " + StatText.Seconds(JujutsuConfig.RedCooldown.Value) + "s")); Plugin.Log.LogInfo((object)(" blue : collapse " + StatText.Number(2.4f) + "s, cost " + StatText.Number(22f) + ", cooldown " + StatText.Seconds(JujutsuConfig.BlueCooldown.Value) + "s, overcharge up to " + StatText.Number(50f))); Plugin.Log.LogInfo((object)(" heal : " + StatText.Fraction(JujutsuConfig.HealingFraction.Value) + " over " + StatText.Number(JujutsuConfig.HealingDuration.Value) + "s, cost " + StatText.Number(25f) + ", cooldown " + StatText.Seconds(JujutsuConfig.HealingCooldown.Value) + "s")); Plugin.Log.LogInfo((object)(" dash : " + StatText.Percent(16f) + " across " + StatText.Metres(7.5f) + ", range " + StatText.Metres(34f) + ", executes under " + StatText.Fraction(0.25f) + ", cost " + StatText.Number(6f) + ", cooldown " + StatText.Seconds(JujutsuConfig.DashCooldown.Value) + "s")); Plugin.Log.LogInfo((object)(" purple : " + StatText.Percent(JujutsuConfig.PurpleDamage.Value) + " -> " + StatText.Percent(JujutsuConfig.PurpleDamage.Value * JujutsuConfig.PurpleChargedDamageMultiplier.Value) + ", travel " + StatText.Metres(5.5f) + ", burst " + StatText.Metres(24f) + ", entry cost " + StatText.Fraction(0.63f) + " of pool, cooldown " + StatText.Seconds(JujutsuConfig.PurpleCooldown.Value) + "s")); Plugin.Log.LogInfo((object)(" domain : " + StatText.Metres(32f) + " for " + StatText.Number(13f) + "s, cost " + StatText.Fraction(JujutsuConfig.DomainEnergyFraction.Value) + " of pool, cooldown " + StatText.Seconds(JujutsuConfig.DomainCooldown.Value) + "s")); } } internal static class GojoSurvivor { internal const string BodyName = "GojoSatoruBody"; internal const string MasterName = "GojoSatoruMonsterMaster"; internal const float BaseArmor = 20f; internal const float BaseCrit = 15f; internal static GameObject BodyPrefab { get; private set; } internal static GameObject MasterPrefab { get; private set; } internal static SurvivorDef SurvivorDef { get; private set; } internal static void Initialize() { CreateBody(); CreateSkills(); CreateMaster(); CreateSurvivorDef(); RegisterStates(); } private static void CreateBody() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) GameObject obj = LegacyResourcesAPI.Load("Prefabs/CharacterBodies/CommandoBody"); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidOperationException("Could not load CommandoBody; Gojo cannot be initialized."); } BodyPrefab = PrefabAPI.InstantiateClone(obj, "GojoSatoruBody"); CharacterBody component = BodyPrefab.GetComponent(); component.baseNameToken = "CODEX_GOJO_NAME"; component.subtitleNameToken = "CODEX_GOJO_SUBTITLE"; component.portraitIcon = (Texture)(object)GojoAssets.Portrait; component.bodyColor = GojoAssets.Infinity; component.baseMaxHealth = 125f; component.levelMaxHealth = 37.5f; component.baseRegen = 1.5f; component.levelRegen = 0.3f; component.baseDamage = 12f; component.levelDamage = 2.4f; component.baseArmor = 20f; component.baseCrit = 15f; component.baseMoveSpeed = 7.5f; component.baseAcceleration = 90f; component.baseJumpCount = 1; BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); BodyPrefab.AddComponent(); RecolorModel(BodyPrefab, display: false); GojoImportedModel.Apply(BodyPrefab); NoItemDisplaysController.Apply(BodyPrefab); PodlessSpawn.Apply(BodyPrefab); JujutsuCrosshairAim.Apply(BodyPrefab); InheritedSkins.KeepFirstOnly(BodyPrefab); GojoExtraSkins.RegisterOnPrefab(BodyPrefab); BodyPrefab.AddComponent(); JujutsuContentPack.BodyPrefabs.Add(BodyPrefab); } private static void CreateSkills() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) GenericSkill[] components = BodyPrefab.GetComponents(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } SkillLocator component = BodyPrefab.GetComponent(); component.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "CODEX_GOJO_PASSIVE_NAME", skillDescriptionToken = "CODEX_GOJO_PASSIVE_DESCRIPTION", icon = GojoAssets.PassiveIcon }; component.primary = CreateSkillSlot("Primary"); component.secondary = CreateSkillSlot("Secondary"); component.utility = CreateSkillSlot("Utility"); component.special = CreateSkillSlot("Special"); AddSkill(component.primary.skillFamily, CreateSkillDef("GojoJab", "CODEX_GOJO_JAB_NAME", "CODEX_GOJO_JAB_DESCRIPTION", GojoAssets.FistIcon, typeof(GojoJabState), "Weapon", 0.18f, (InterruptPriority)1, isCombatSkill: true, 0f, groundedOnly: false, 0f, mustKeyPress: false)); AddSkill(component.secondary.skillFamily, CreateSkillDef("GojoKick", "CODEX_GOJO_KICK_NAME", "CODEX_GOJO_KICK_DESCRIPTION", GojoAssets.KickIcon, typeof(GojoKickState), "Weapon", 2f, (InterruptPriority)1, isCombatSkill: true)); AddSkill(component.utility.skillFamily, CreateSkillDef("GojoInfinity", "CODEX_GOJO_INFINITY_NAME", "CODEX_GOJO_INFINITY_DESCRIPTION", GojoAssets.ReverseCursedIcon, typeof(InfinityState), "Body", JujutsuConfig.HealingCooldown.Value, (InterruptPriority)2, isCombatSkill: false, 25f)); SkillDef val = CreateSkillDef("GojoHollowPurple", "CODEX_GOJO_PURPLE_NAME", "CODEX_GOJO_PURPLE_DESCRIPTION", GojoAssets.PurpleIcon, typeof(HollowPurpleState), "Weapon", JujutsuConfig.PurpleCooldown.Value, (InterruptPriority)2, isCombatSkill: true, 0f, groundedOnly: false, HollowPurpleState.MinimumChargeCostFraction); val.beginSkillCooldownOnSkillEnd = false; AddSkill(component.special.skillFamily, val); GenericSkill val2 = CreateSkillSlot("SideRed"); GenericSkill val3 = CreateSkillSlot("SideBlue"); GenericSkill val4 = CreateSkillSlot("Domain"); val2.hideInCharacterSelect = true; val2.hideInLoadoutSelect = true; val3.hideInCharacterSelect = true; val3.hideInLoadoutSelect = true; val4.hideInCharacterSelect = true; val4.hideInLoadoutSelect = true; SkillDef val5 = CreateSkillDef("GojoRed", "CODEX_GOJO_RED_NAME", "CODEX_GOJO_RED_DESCRIPTION", GojoAssets.RedIcon, typeof(ReversalRedState), "Weapon", JujutsuConfig.RedCooldown.Value, (InterruptPriority)1, isCombatSkill: true, 26f); val5.mustKeyPress = true; AddSkill(val2.skillFamily, val5); SkillDef val6 = CreateSkillDef("GojoBlue", "CODEX_GOJO_BLUE_NAME", "CODEX_GOJO_BLUE_DESCRIPTION", GojoAssets.BlueIcon, typeof(LapseBlueState), "Weapon", JujutsuConfig.BlueCooldown.Value, (InterruptPriority)1, isCombatSkill: true, 22f); val6.mustKeyPress = true; AddSkill(val3.skillFamily, val6); SkillDef val7 = CreateSkillDef("GojoDomainExpansion", "CODEX_GOJO_DOMAIN_NAME", "CODEX_GOJO_DOMAIN_DESCRIPTION", GojoAssets.DomainIcon, typeof(DomainExpansionState), "Weapon", JujutsuConfig.DomainCooldown.Value, (InterruptPriority)2, isCombatSkill: true, 0f, groundedOnly: false, JujutsuConfig.DomainEnergyFraction.Value); val7.mustKeyPress = true; AddSkill(val4.skillFamily, val7); SkillDef val8 = CreateSkillDef("GojoDash", "CODEX_GOJO_DASH_NAME", "CODEX_GOJO_DASH_DESCRIPTION", GojoAssets.DashIcon, typeof(GojoDashState), "Body", JujutsuConfig.DashCooldown.Value, (InterruptPriority)1, isCombatSkill: false, 6f); val8.mustKeyPress = true; val8.baseMaxStock = 1; AddSkillFirst(component.utility.skillFamily, val8); BodyPrefab.GetComponent().Configure(val2, val3, val4); JujutsuSkillNetworkFix.RegisterExtraSkills(BodyPrefab); } private static GenericSkill CreateSkillSlot(string slotName) { GenericSkill obj = BodyPrefab.AddComponent(); obj.skillName = slotName; SkillFamily val = ScriptableObject.CreateInstance(); ((Object)val).name = "GojoSatoruBody" + slotName + "Family"; val.variants = Array.Empty(); obj._skillFamily = val; JujutsuContentPack.SkillFamilies.Add(val); return obj; } private static SkillDef CreateSkillDef(string name, string nameToken, string descriptionToken, Sprite icon, Type activationState, string stateMachine, float cooldown, InterruptPriority interruptPriority, bool isCombatSkill, float energyCost = 0f, bool groundedOnly = false, float energyCostFraction = 0f, bool mustKeyPress = true) { //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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) SkillDef val = (SkillDef)(object)(groundedOnly ? ScriptableObject.CreateInstance() : ((energyCost > 0f || energyCostFraction > 0f) ? ScriptableObject.CreateInstance() : ((CursedEnergySkillDef)(object)ScriptableObject.CreateInstance()))); if (val is CursedEnergySkillDef cursedEnergySkillDef) { cursedEnergySkillDef.energyCost = energyCost; cursedEnergySkillDef.energyCostFraction = energyCostFraction; } ((Object)val).name = name; val.skillName = name; val.skillNameToken = nameToken; val.skillDescriptionToken = descriptionToken; val.icon = icon; val.activationState = new SerializableEntityStateType(activationState); val.activationStateMachineName = stateMachine; val.interruptPriority = interruptPriority; val.baseRechargeInterval = cooldown; val.baseMaxStock = 1; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.fullRestockOnAssign = true; val.resetCooldownTimerOnUse = false; val.beginSkillCooldownOnSkillEnd = isCombatSkill; val.canceledFromSprinting = false; val.cancelSprintingOnActivation = isCombatSkill; val.forceSprintDuringState = !isCombatSkill; val.mustKeyPress = mustKeyPress; val.isCombatSkill = isCombatSkill; val.keywordTokens = (isCombatSkill ? Array.Empty() : new string[1] { "KEYWORD_AGILE" }); JujutsuContentPack.SkillDefs.Add(val); return val; } private static void AddSkill(SkillFamily family, SkillDef skillDef) { //IL_0027: 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_0049: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref family.variants, family.variants.Length + 1); Variant[] variants = family.variants; int num = family.variants.Length - 1; Variant val = new Variant { skillDef = skillDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } private static void AddSkillFirst(SkillFamily family, SkillDef skillDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Variant[] array = (Variant[])(object)new Variant[family.variants.Length + 1]; Variant val = new Variant { skillDef = skillDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); array[0] = val; Array.Copy(family.variants, 0, array, 1, family.variants.Length); family.variants = array; } private static void CreateMaster() { GameObject val = LegacyResourcesAPI.Load("Prefabs/CharacterMasters/CommandoMonsterMaster"); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)"CommandoMonsterMaster was not found; doppelganger AI will be unavailable."); return; } MasterPrefab = PrefabAPI.InstantiateClone(val, "GojoSatoruMonsterMaster"); MasterPrefab.GetComponent().bodyPrefab = BodyPrefab; JujutsuContentPack.MasterPrefabs.Add(MasterPrefab); } private static void CreateSurvivorDef() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) GameObject val = LegacyResourcesAPI.Load("Prefabs/CharacterDisplays/CommandoDisplay"); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? PrefabAPI.InstantiateClone(val, "GojoSatoruDisplay", false) : null); if (Object.op_Implicit((Object)(object)val2)) { RecolorModel(val2, display: true); GojoImportedModel.Apply(val2); NoItemDisplaysController.Apply(val2); DisplaySoundSilencer.Apply(val2, "Gojo"); GojoExtraSkins.RegisterOnPrefab(val2); } else { Plugin.Log.LogWarning((object)"CommandoDisplay was not found; character select preview will be empty."); } SurvivorDef = ScriptableObject.CreateInstance(); ((Object)SurvivorDef).name = "sdGojoSatoru"; SurvivorDef.cachedName = "GojoSatoru"; SurvivorDef.bodyPrefab = BodyPrefab; SurvivorDef.displayPrefab = val2; SurvivorDef.primaryColor = GojoAssets.Infinity; SurvivorDef.displayNameToken = "CODEX_GOJO_NAME"; SurvivorDef.descriptionToken = "CODEX_GOJO_DESCRIPTION"; SurvivorDef.outroFlavorToken = "CODEX_GOJO_OUTRO_FLAVOR"; SurvivorDef.mainEndingEscapeFailureFlavorToken = "CODEX_GOJO_OUTRO_FAILURE"; SurvivorDef.desiredSortPosition = 90f; JujutsuContentPack.SurvivorDefs.Add(SurvivorDef); JujutsuCharacters.Register(new JujutsuCharacter { Key = "Gojo", BodyPrefix = "GojoSatoru", MenuOrder = 1, Survivor = SurvivorDef, MenuSkin = "SUIT", SpawnLine = () => GojoAssets.SpawnVoice, FlashVoice = delegate(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) GojoAssets.TryPlayVoice(position, 1f); }, EffortVoice = GojoAssets.TryPlayVoice }); } private static void RegisterStates() { JujutsuContentPack.EntityStates.Add(typeof(ReversalRedState)); JujutsuContentPack.EntityStates.Add(typeof(LapseBlueState)); JujutsuContentPack.EntityStates.Add(typeof(InfinityState)); JujutsuContentPack.EntityStates.Add(typeof(HollowPurpleState)); JujutsuContentPack.EntityStates.Add(typeof(HollowPurpleProjectileState)); JujutsuContentPack.EntityStates.Add(typeof(GojoJabState)); JujutsuContentPack.EntityStates.Add(typeof(GojoKickState)); JujutsuContentPack.EntityStates.Add(typeof(DomainExpansionState)); JujutsuContentPack.EntityStates.Add(typeof(GojoDashState)); } private static void RecolorModel(GameObject prefab, bool display) { //IL_0080: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) CharacterModel componentInChildren = prefab.GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } RendererInfo[] baseRendererInfos = componentInChildren.baseRendererInfos; for (int i = 0; i < baseRendererInfos.Length; i++) { Material defaultMaterial = baseRendererInfos[i].defaultMaterial; if (Object.op_Implicit((Object)(object)defaultMaterial)) { Material val = Object.Instantiate(defaultMaterial); ((Object)val).name = "matGojoRuntime" + i; Color val2 = ((i % 3 == 0) ? new Color(0.015f, 0.02f, 0.035f) : new Color(0.72f, 0.84f, 0.92f)); if (val.HasProperty("_Color")) { val.SetColor("_Color", val2); } if (val.HasProperty("_MainColor")) { val.SetColor("_MainColor", val2); } if (val.HasProperty("_EmColor")) { val.SetColor("_EmColor", GojoAssets.Blue * (display ? 1.3f : 0.8f)); } if (val.HasProperty("_EmPower")) { val.SetFloat("_EmPower", display ? 2f : 1f); } baseRendererInfos[i].defaultMaterial = val; } } componentInChildren.baseRendererInfos = baseRendererInfos; } } internal static class JujutsuAssetPaths { private static readonly List roots = new List(4); internal static IReadOnlyList Roots => roots; internal static void AddPlugin(string pluginDirectory) { if (!string.IsNullOrEmpty(pluginDirectory)) { string item = Path.Combine(pluginDirectory, "assets"); if (!roots.Contains(item)) { roots.Add(item); } } } internal static string Find(params string[] parts) { if (parts == null || parts.Length == 0) { if (roots.Count <= 0) { return string.Empty; } return roots[0]; } int num = (string.Equals(parts[0], "assets", StringComparison.Ordinal) ? 1 : 0); string text = ((parts.Length > num) ? Path.Combine(Trim(parts, num)) : string.Empty); string text2 = null; foreach (string root in roots) { string text3 = ((text.Length == 0) ? root : Path.Combine(root, text)); if (text2 == null) { text2 = text3; } if (File.Exists(text3) || Directory.Exists(text3)) { return text3; } } return text2 ?? string.Empty; } private static string[] Trim(string[] parts, int skip) { string[] array = new string[parts.Length - skip]; Array.Copy(parts, skip, array, 0, array.Length); return array; } } internal sealed class JujutsuCharacter { internal string Key; internal string BodyPrefix; internal int MenuOrder; internal SurvivorDef Survivor; internal string MenuSkin; internal Func SpawnLine; internal Action FlashVoice; internal Action EffortVoice; internal Action RewardFlash; } internal static class JujutsuCharacters { private static readonly List registered = new List(4); internal static int Count => registered.Count; internal static void Register(JujutsuCharacter character) { if (character == null || string.IsNullOrEmpty(character.Key)) { return; } for (int i = 0; i < registered.Count; i++) { if (string.Equals(registered[i].Key, character.Key, StringComparison.Ordinal)) { registered[i] = character; return; } } registered.Add(character); } internal static JujutsuCharacter For(string key) { if (string.IsNullOrEmpty(key)) { return null; } foreach (JujutsuCharacter item in registered) { if (string.Equals(item.Key, key, StringComparison.Ordinal)) { return item; } } return null; } internal static JujutsuCharacter ForBody(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } foreach (JujutsuCharacter item in registered) { if (!string.IsNullOrEmpty(item.BodyPrefix) && ((Object)body).name.StartsWith(item.BodyPrefix, StringComparison.Ordinal)) { return item; } } return null; } internal static List Roster() { List list = new List(registered); list.Sort((JujutsuCharacter a, JujutsuCharacter b) => a.MenuOrder.CompareTo(b.MenuOrder)); return list; } } internal static class JujutsuConfig { internal static ConfigEntry SideSkill1Key; internal static ConfigEntry SideSkill2Key; internal static ConfigEntry DomainKey; internal static ConfigEntry DashCooldown; internal static ConfigEntry AirborneClip; internal static ConfigEntry SukunaLobbyClip; internal static ConfigEntry BlackFlashChance; internal static ConfigEntry BlackFlashMultiplier; internal static ConfigEntry RedDamage; internal static ConfigEntry RedCooldown; internal static ConfigEntry RedControlSpeed; internal static ConfigEntry BlueDamagePerTick; internal static ConfigEntry BlueCooldown; internal static ConfigEntry BlueControlSpeed; internal static ConfigEntry HealingDuration; internal static ConfigEntry HealingFraction; internal static ConfigEntry HealingCooldown; internal static ConfigEntry PurpleDamage; internal static ConfigEntry PurpleChargedDamageMultiplier; internal static ConfigEntry PurpleCooldown; internal static ConfigEntry DomainCooldown; internal static ConfigEntry DomainEnergyFraction; internal static ConfigEntry BarrierPerSecond; internal static ConfigEntry BarrierCap; internal static ConfigEntry GojoOutfitScale; internal static ConfigEntry GojoOutfitHandSideways; internal static ConfigEntry SukunaModelScale; internal static ConfigEntry YujiModelScale; internal static ConfigEntry TodoModelScale; internal static ConfigEntry YujiNeckCorrection; internal static ConfigEntry TodoFightAnimation; internal static ConfigEntry FollowGameVolume; internal static ConfigEntry NormaliseSounds; internal static ConfigEntry ModVolume; internal static ConfigEntry VoiceVolume; internal static ConfigEntry ThemeVolume; internal static ConfigEntry CompressTextures; internal static ConfigEntry MainMenuCharacters; internal static ConfigEntry MainMenuDistance; internal static ConfigEntry MainMenuSpacing; internal static ConfigEntry MainMenuHeight; internal static ConfigEntry MainMenuScale; internal static ConfigEntry MainMenuTitleClearance; internal static void Initialize(ConfigFile config) { //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) CompressTextures = config.Bind("08 - Models", "Compress textures", true, "Block compress each model and skin texture as it loads. Off starts the game about a second sooner and costs roughly a gigabyte more video memory. The log says what each texture cost and saved either way."); FollowGameVolume = config.Bind("10 - Audio", "Follow game volume sliders v2", false, "Multiplies the mod's own sounds by the game's Master, SFX and Music sliders as well as by the settings below. Off — the default — means the settings below are the whole story and turning the game down leaves the mod where it is."); NormaliseSounds = config.Bind("10 - Audio", "Normalise sound files", true, "Brings every sound up to a common level as it is decoded, so the levels above apply equally to all of them. Off plays each file at whatever it was mastered at, which is how the mod behaved before 4.108 — quiet techniques and loud voices. Takes effect on restart."); ModVolume = config.Bind("10 - Audio", "Mod volume", 1f, "Applies to everything the mod plays. 1 leaves each sound at the level it was designed at. Above 1 is louder than shipped and eventually clips, which is audible as harshness rather than as more volume — if it clips before it is loud enough, the recording is the limit and the log says so."); VoiceVolume = config.Bind("10 - Audio", "Voice lines v2", 0.6f, "Level of the spoken lines and the character sounds mixed with them. The name carries a v2 so this default reaches a config written with the old one: it was 0.1, chosen before anything else multiplied it, and against a decoded file that rarely peaks near full scale that was most of the way to inaudible on its own."); ThemeVolume = config.Bind("10 - Audio", "Domain themes v2", 0.25f, "Level of the music a Domain Expansion opens with. Kept below the effects on purpose, because it plays over the game's own track rather than instead of it — but 0.05, which is what the source held, was under that track rather than beneath it."); GojoOutfitScale = config.Bind("08 - Models", "Gojo outfit scale", 1f, "Multiplies the size Gojo's extra outfits are matched to. 1 is the measured match against his rig; below 1 is shorter."); GojoOutfitHandSideways = config.Bind("08 - Models", "Gojo outfit hand sideways", 0.04f, "Moves Gojo's hand out from his face in the flight pose on the extra outfits, in metres, along his own shoulder line. 0 is the rig's placement exactly; positive is to his right. No other pose and no other skin is affected."); SukunaModelScale = config.Bind("08 - Models", "Sukuna model scale", 1.27f, "Size of Sukuna's imported model. 1.27 is what he shipped with; below that is shorter."); YujiModelScale = config.Bind("08 - Models", "Yuji model scale", 1.2f, "Size of Yuji's imported model. 1.2 stands him level with Sukuna, who is 1.27 over a shorter mesh; at the 1.1 he shipped with he was a head short of a character he is drawn the same height as."); TodoFightAnimation = config.Bind("08 - Models", "Todo fight animation", false, "Plays the imported six-punch combo and the leap out of it. Off — the default while the retarget is wrong — falls back to the shared punch clip, which is what he used before the set existed and is the last state known to look right."); YujiNeckCorrection = config.Bind("08 - Models", "Yuji neck correction", 1f, "How much of the measured excess to take out of the neck on the outfits that stand taller than the rest. 1 is the measurement itself and leaves every outfit the same height, so nothing changes size as skins are switched. 0 turns the correction off and gives those outfits the neck the files give them. Applied on the next skin change."); TodoModelScale = config.Bind("08 - Models", "Todo model scale", 1.1f, "Size of Todo's imported model. His mesh is the tallest of the four before scaling, and stays so at an equal setting."); MainMenuCharacters = config.Bind("09 - Main menu", "Show both survivors", true, "Stands Gojo and Sukuna in the title screen."); MainMenuDistance = config.Bind("09 - Main menu", "Depth v4", 30f, "Metres into the screen. The title screen focuses on its middle distance and blurs everything nearer, so this is what to raise if they look soft. They do not shrink when it is raised: the size is compensated to keep them where they sit on screen."); MainMenuSpacing = config.Bind("09 - Main menu", "Spread v5", 0.21f, "How far the outermost two stand from the middle of the screen, as a fraction of its width. The other two are spaced evenly between them."); MainMenuHeight = config.Bind("09 - Main menu", "Screen height v4", 0.45f, "Height up the screen, 0 at the bottom edge and 1 at the top. Around the horizon, so the hill in front cannot swallow them."); MainMenuScale = config.Bind("09 - Main menu", "Scale v2", 3f, "Size on the title screen only. Independent of depth: moving them deeper does not shrink them."); MainMenuTitleClearance = config.Bind("09 - Main menu", "Title clearance", 0.62f, "Highest point up the screen the tallest head may reach, 0 at the bottom edge and 1 at the top. The group is shrunk on its feet until it fits under the game's logo. Set to 1 to switch the check off and keep whatever Scale gives."); SideSkill1Key = config.Bind("00 - Controls", "Side skill 1", new KeyboardShortcut((KeyCode)326, Array.Empty()), "Gojo: Reversal Red. Sukuna: Dismantle. Mouse3 is the first thumb button, usually labelled Mouse4."); SideSkill2Key = config.Bind("00 - Controls", "Side skill 2", new KeyboardShortcut((KeyCode)327, Array.Empty()), "Gojo: Lapse Blue. Sukuna: Cleave. Mouse4 is the second thumb button, usually labelled Mouse5."); DomainKey = config.Bind("00 - Controls", "Domain Expansion", new KeyboardShortcut((KeyCode)116, Array.Empty()), "Domain Expansion, on every character that has one."); DashCooldown = config.Bind("01 - Gojo", "Dash cooldown v2", 7f, "Seconds before Instant Transmission can be used again."); SukunaLobbyClip = config.Bind("00 - Controls", "Sukuna character select stance v2", "Idle", "Clip Sukuna holds in character select. 'Idle' is the stance he uses in a run. 'LobbyIdle' is the separately downloaded Warrior Idle, which is longer and sweeps wider."); AirborneClip = config.Bind("00 - Controls", "Gojo airborne animation", "model|Spell4_Dash_model", "Clip played while Gojo is jumping or flying. The bundle's two Mixamo imports, 'Falling Idle' and 'Jumping UP', are the only clips in it that are not authored for this rig, and their baked root orientation turns the model to face backwards. Alternatives worth trying: model|Spell4_Base_model, model|Spell4_CC_Immune_model, model|Spell1_B_model, model|Spell2_Strong_model, model|IdleReady_model."); BlackFlashChance = config.Bind("07 - Black Flash", "Chance percent", 1f, "Chance per melee hit, in percent. Melee only, for both survivors: techniques that already strike from range are deliberately excluded."); BlackFlashMultiplier = config.Bind("07 - Black Flash", "Damage multiplier", 2.5f, "Damage multiplier applied when Black Flash procs."); RedDamage = config.Bind("01 - Red", "Damage coefficient v4", 9f, "Damage as a multiplier of Gojo's damage stat."); RedCooldown = config.Bind("01 - Red", "Cooldown v4", 9f, "Cooldown in seconds."); RedControlSpeed = config.Bind("01 - Red", "Controlled sphere speed", 42f, "Legacy control value used to scale Red's distance per mouse-wheel step."); BlueDamagePerTick = config.Bind("02 - Blue", "Damage per tick v2", 0.38f, "Damage per 0.3 second tick as a multiplier of Gojo's damage stat."); BlueCooldown = config.Bind("02 - Blue", "Cooldown v4", 9f, "Cooldown in seconds."); BlueControlSpeed = config.Bind("02 - Blue", "Controlled sphere speed", 32f, "Legacy control value used to scale Blue's distance per mouse-wheel step."); HealingDuration = config.Bind("03 - Reverse Cursed Technique", "Duration", 1.25f, "How long Gojo must remain in place while healing."); HealingFraction = config.Bind("03 - Reverse Cursed Technique", "Healing fraction", 0.45f, "Fraction of maximum health restored over the full duration."); HealingCooldown = config.Bind("03 - Reverse Cursed Technique", "Cooldown", 8f, "Cooldown in seconds."); PurpleDamage = config.Bind("04 - Hollow Purple", "Damage coefficient v8", 33.75f, "Minimum-charge sphere damage as a multiplier of Gojo's damage stat."); PurpleChargedDamageMultiplier = config.Bind("04 - Hollow Purple", "Fully charged damage multiplier", 2f, "Additional multiplier reached when Hollow Purple is charged for the full six seconds."); PurpleCooldown = config.Bind("04 - Hollow Purple", "Cooldown v3", 30f, "Cooldown in seconds."); DomainCooldown = config.Bind("05 - Domain Expansion", "Cooldown", 55f, "Cooldown in seconds."); DomainEnergyFraction = config.Bind("05 - Domain Expansion", "Cursed energy cost fraction", 0.9f, "Share of maximum cursed energy each Domain Expansion costs, for all three who have one. Priced against the pool rather than as a flat amount, so the ultimate costs the same to cast at every character level instead of quietly getting cheaper as the pool grows past it."); BarrierPerSecond = config.Bind("06 - Six Eyes", "Barrier per second", 0.03f, "Fraction of full combined health restored as barrier each second."); BarrierCap = config.Bind("06 - Six Eyes", "Barrier cap", 0.25f, "Maximum barrier as a fraction of full combined health."); } } internal sealed class JujutsuContentPack : IContentPackProvider { internal readonly struct Mark { internal int BodyPrefabs { get; } internal int MasterPrefabs { get; } internal int SurvivorDefs { get; } internal int SkillDefs { get; } internal int SkillFamilies { get; } internal int EntityStates { get; } internal int Buffs { get; } internal Mark(int bodyPrefabs, int masterPrefabs, int survivorDefs, int skillDefs, int skillFamilies, int entityStates, int buffs) { BodyPrefabs = bodyPrefabs; MasterPrefabs = masterPrefabs; SurvivorDefs = survivorDefs; SkillDefs = skillDefs; SkillFamilies = skillFamilies; EntityStates = entityStates; Buffs = buffs; } } internal static readonly List BodyPrefabs = new List(); internal static readonly List MasterPrefabs = new List(); internal static readonly List SurvivorDefs = new List(); internal static readonly List SkillDefs = new List(); internal static readonly List SkillFamilies = new List(); internal static readonly List EntityStates = new List(); internal static readonly List Buffs = new List(); private readonly ContentPack contentPack = new ContentPack(); public string identifier => "dev.marmennz.satorugojo"; internal void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddContentPackProvider); } internal static Mark MarkContent() { return new Mark(BodyPrefabs.Count, MasterPrefabs.Count, SurvivorDefs.Count, SkillDefs.Count, SkillFamilies.Count, EntityStates.Count, Buffs.Count); } internal static string RollBackTo(Mark mark) { int num = Truncate(BodyPrefabs, mark.BodyPrefabs); int num2 = Truncate(MasterPrefabs, mark.MasterPrefabs); int num3 = Truncate(SurvivorDefs, mark.SurvivorDefs); int num4 = Truncate(SkillDefs, mark.SkillDefs); int num5 = Truncate(SkillFamilies, mark.SkillFamilies); int num6 = Truncate(EntityStates, mark.EntityStates); int num7 = Truncate(Buffs, mark.Buffs); if (num + num2 + num3 + num4 + num5 + num6 + num7 == 0) { return null; } return $"{num} body, {num2} master, {num3} survivor, " + $"{num4} skill, {num5} skill family, {num6} entity " + $"state and {num7} buff entries"; } private static int Truncate(List list, int count) { int num = list.Count - count; if (num <= 0) { return 0; } list.RemoveRange(count, num); return num; } private void AddContentPackProvider(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } private static UnlockableDef[] EclipseLadder() { List list = new List(); foreach (SurvivorDef survivorDef in SurvivorDefs) { if (Object.op_Implicit((Object)(object)survivorDef) && !string.IsNullOrEmpty(survivorDef.cachedName)) { for (int i = EclipseRun.minEclipseLevel + 1; i <= EclipseRun.maxEclipseLevel; i++) { string text = $"Eclipse.{survivorDef.cachedName}.{i}"; UnlockableDef val = ScriptableObject.CreateInstance(); ((Object)val).name = text; val.cachedName = text; val.hidden = true; list.Add(val); } } } Plugin.Log.LogInfo((object)($"Eclipse: {list.Count} rungs across " + $"{SurvivorDefs.Count} survivor(s).")); return list.ToArray(); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.bodyPrefabs.Add(BodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(MasterPrefabs.ToArray()); contentPack.survivorDefs.Add(SurvivorDefs.ToArray()); contentPack.skillDefs.Add(SkillDefs.ToArray()); contentPack.skillFamilies.Add(SkillFamilies.ToArray()); contentPack.entityStateTypes.Add(EntityStates.ToArray()); contentPack.buffDefs.Add(Buffs.ToArray()); contentPack.unlockableDefs.Add(EclipseLadder()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } internal static class JujutsuNewcomers { internal readonly struct SideSlots { internal Dictionary Made { get; } internal Dictionary Defs { get; } internal Color Accent { get; } internal SideSlots(Dictionary made, Dictionary defs, Color accent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Made = made; Defs = defs; Accent = accent; } } internal sealed class SkillSlot { internal string Name; internal string TokenSuffix; internal Type State; internal Sprite Icon; internal float Cooldown; internal float EnergyCost; internal float EnergyCostFraction; internal int MaxStock = 1; internal Func MakeSkillDef; internal bool MustKeyPress = true; internal InterruptPriority Priority = (InterruptPriority)1; internal SkillSlot[] Alternatives; internal SkillSlot[] AllVariants { get { if (Alternatives == null || Alternatives.Length == 0) { return new SkillSlot[1] { this }; } return new SkillSlot[1] { this }.Concat(Alternatives).ToArray(); } } } internal static void GiveSkinIcon(GameObject bodyPrefab, string file) { ModelSkinController val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponentInChildren(true) : null); if (!((Object)(object)val == (Object)null) && val.skins != null && val.skins.Length != 0) { Sprite val2 = GojoAssets.LoadIcon(file, () => (Sprite)null); if (!Object.op_Implicit((Object)(object)val2)) { Plugin.Log.LogInfo((object)("No skin portrait at ui/icons/" + file + ".png; the inherited icon is kept.")); return; } val.skins[0].icon = val2; Plugin.Log.LogInfo((object)("Skin portrait " + file + " applied to " + ((Object)bodyPrefab).name + ".")); } } internal static void AddNeckFit(GameObject prefab) { CharacterModel val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponentInChildren(true) : null); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)"Yuji has no CharacterModel to hang the neck fit on."); } else if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { ((Component)val).gameObject.AddComponent(); } } internal static SurvivorDef Build(string bodyName, string masterName, string displayName, string cachedName, string tokenPrefix, Color colour, float sortPosition, MixamoCharacterModel model, float maxHealth, float damage, float armour, float moveSpeed, Dictionary slots = null, Dictionary sideSlots = null, Texture2D portrait = null, Sprite passiveIcon = null, Action configureBody = null, Action configureDisplay = null) { //IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_044b: Unknown result type (might be due to invalid IL or missing references) //IL_044d: 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) GameObject val = LegacyResourcesAPI.Load("Prefabs/CharacterBodies/MercBody"); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogError((object)("MercBody could not be loaded; " + cachedName + " is skipped.")); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyName); CharacterBody component = val2.GetComponent(); component.baseNameToken = tokenPrefix + "NAME"; component.subtitleNameToken = tokenPrefix + "SUBTITLE"; component.bodyColor = colour; component.portraitIcon = (Texture)(object)(Object.op_Implicit((Object)(object)portrait) ? portrait : SolidPortrait(colour)); component.baseMaxHealth = maxHealth; component.levelMaxHealth = maxHealth * 0.3f; component.baseRegen = 1.5f; component.levelRegen = 0.3f; component.baseDamage = damage; component.levelDamage = damage * 0.2f; component.baseArmor = armour; component.baseCrit = 5f; component.baseMoveSpeed = moveSpeed; component.baseAcceleration = 80f; component.baseJumpPower = 15f; component.baseJumpCount = 1; val2.AddComponent(); val2.AddComponent(); bool num = model.Apply(val2); if (num && cachedName == "YujiItadori") { AddNeckFit(val2); } if (!num) { Plugin.Log.LogWarning((object)(cachedName + " kept the Mercenary mesh; the model file was missing or unreadable.")); } InheritedSkins.KeepFirstOnly(val2); if (Object.op_Implicit((Object)(object)passiveIcon)) { SkillLocator component2 = val2.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = tokenPrefix + "PASSIVE_NAME", skillDescriptionToken = tokenPrefix + "PASSIVE_DESCRIPTION", icon = passiveIcon }; } } if (slots != null) { SkillLocator component3 = val2.GetComponent(); foreach (KeyValuePair slot in slots) { ReplaceSlot(val2, bodyName, tokenPrefix, (GenericSkill)(slot.Key switch { "Primary" => Object.op_Implicit((Object)(object)component3) ? component3.primary : null, "Secondary" => Object.op_Implicit((Object)(object)component3) ? component3.secondary : null, "Utility" => Object.op_Implicit((Object)(object)component3) ? component3.utility : null, "Special" => Object.op_Implicit((Object)(object)component3) ? component3.special : null, _ => null, }), slot.Value); } } if (sideSlots != null) { Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); foreach (KeyValuePair sideSlot in sideSlots) { GenericSkill val3 = AddHiddenSlot(val2, bodyName, sideSlot.Key, sideSlot.Value.Alternatives != null && sideSlot.Value.Alternatives.Length != 0); dictionary2[sideSlot.Key] = ReplaceSlot(val2, bodyName, tokenPrefix, val3, sideSlot.Value); dictionary[sideSlot.Key] = val3; } configureBody?.Invoke(val2, new SideSlots(dictionary, dictionary2, colour)); JujutsuSkillNetworkFix.RegisterExtraSkills(val2); } NoItemDisplaysController.Apply(val2); PodlessSpawn.Apply(val2); JujutsuCrosshairAim.Apply(val2); JujutsuContentPack.BodyPrefabs.Add(val2); GameObject val4 = LegacyResourcesAPI.Load("Prefabs/CharacterMasters/MercMonsterMaster"); if (Object.op_Implicit((Object)(object)val4)) { GameObject val5 = PrefabAPI.InstantiateClone(val4, masterName); val5.GetComponent().bodyPrefab = val2; JujutsuContentPack.MasterPrefabs.Add(val5); } GameObject val6 = LegacyResourcesAPI.Load("Prefabs/CharacterDisplays/MercDisplay"); GameObject val7 = (Object.op_Implicit((Object)(object)val6) ? PrefabAPI.InstantiateClone(val6, displayName, false) : null); if (Object.op_Implicit((Object)(object)val7)) { model.Apply(val7); if (cachedName == "YujiItadori") { AddNeckFit(val7); } NoItemDisplaysController.Apply(val7); DisplaySoundSilencer.Apply(val7, cachedName); configureDisplay?.Invoke(val7); } SurvivorDef val8 = ScriptableObject.CreateInstance(); ((Object)val8).name = "sd" + cachedName; val8.cachedName = cachedName; val8.bodyPrefab = val2; val8.displayPrefab = val7; val8.primaryColor = colour; val8.displayNameToken = tokenPrefix + "NAME"; val8.descriptionToken = tokenPrefix + "DESCRIPTION"; val8.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; val8.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; val8.desiredSortPosition = sortPosition; JujutsuContentPack.SurvivorDefs.Add(val8); return val8; } internal static GojoExtraSkillHud.Variant[] BuildHudVariants(SkillDef[] defs, params (Sprite Icon, string ShortName)[] labels) { if (defs == null) { return null; } int num = Math.Min(defs.Length, labels.Length); GojoExtraSkillHud.Variant[] array = new GojoExtraSkillHud.Variant[num]; for (int i = 0; i < num; i++) { array[i] = new GojoExtraSkillHud.Variant { SkillDef = defs[i], Icon = labels[i].Icon, ShortName = labels[i].ShortName }; } return array; } internal static GenericSkill AddHiddenSlot(GameObject bodyPrefab, string bodyName, string slotName, bool selectable = false) { GenericSkill obj = bodyPrefab.AddComponent(); obj.skillName = slotName; obj.hideInCharacterSelect = true; obj.hideInLoadoutSelect = !selectable; SkillFamily val = ScriptableObject.CreateInstance(); ((Object)val).name = bodyName + slotName + "Family"; val.variants = Array.Empty(); obj._skillFamily = val; JujutsuContentPack.SkillFamilies.Add(val); return obj; } internal static SkillDef[] ReplaceSlot(GameObject bodyPrefab, string bodyName, string tokenPrefix, GenericSkill slot, SkillSlot definition) { if (!Object.op_Implicit((Object)(object)slot)) { Plugin.Log.LogWarning((object)(bodyName + " has no " + definition.TokenSuffix + " slot to replace.")); return Array.Empty(); } SkillSlot[] allVariants = definition.AllVariants; SkillDef[] array = (SkillDef[])(object)new SkillDef[allVariants.Length]; for (int i = 0; i < allVariants.Length; i++) { array[i] = BuildSkillDef(tokenPrefix, allVariants[i]); JujutsuContentPack.EntityStates.Add(allVariants[i].State); } SkillFamily val = ScriptableObject.CreateInstance(); ((Object)val).name = bodyName + definition.TokenSuffix + "Family"; val.variants = array.Select(delegate(SkillDef skillDef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) Variant result = new Variant { skillDef = skillDef }; ((Variant)(ref result)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); return result; }).ToArray(); slot._skillFamily = val; JujutsuContentPack.SkillFamilies.Add(val); return array; } internal static SkillDef BuildSkillDef(string tokenPrefix, SkillSlot definition) { //IL_00b7: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) SkillDef val = (SkillDef)(object)((definition.MakeSkillDef != null) ? ((CursedEnergySkillDef)(object)definition.MakeSkillDef()) : ((definition.EnergyCost > 0f || definition.EnergyCostFraction > 0f) ? ScriptableObject.CreateInstance() : ((CursedEnergySkillDef)(object)ScriptableObject.CreateInstance()))); if (val is CursedEnergySkillDef cursedEnergySkillDef) { cursedEnergySkillDef.energyCost = definition.EnergyCost; cursedEnergySkillDef.energyCostFraction = definition.EnergyCostFraction; } ((Object)val).name = definition.Name; val.skillName = definition.Name; val.skillNameToken = tokenPrefix + definition.TokenSuffix + "_NAME"; val.skillDescriptionToken = tokenPrefix + definition.TokenSuffix + "_DESCRIPTION"; val.icon = definition.Icon; val.activationState = new SerializableEntityStateType(definition.State); val.activationStateMachineName = "Weapon"; val.interruptPriority = definition.Priority; val.baseRechargeInterval = definition.Cooldown; val.baseMaxStock = Mathf.Max(1, definition.MaxStock); val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.fullRestockOnAssign = true; val.resetCooldownTimerOnUse = false; val.beginSkillCooldownOnSkillEnd = definition.Cooldown > 0f; val.mustKeyPress = definition.MustKeyPress; val.canceledFromSprinting = false; val.cancelSprintingOnActivation = true; val.isCombatSkill = true; val.keywordTokens = Array.Empty(); JujutsuContentPack.SkillDefs.Add(val); return val; } internal static Texture2D SolidPortrait(Color colour) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[16384]; for (int i = 0; i < array.Length; i++) { array[i] = colour; } val.SetPixels(array); val.Apply(); return val; } } internal static class JujutsuSfxAssets { private static GojoAssets.DecodedAttackSound[] lightWhooshes; private static GojoAssets.DecodedAttackSound[] heavyWhooshes; private static GojoAssets.DecodedAttackSound[] meleeLight; private static GojoAssets.DecodedAttackSound[] meleeHeavy; private static GojoAssets.DecodedAttackSound[] slashes; private static GojoAssets.DecodedAttackSound[] blackFlash; internal static IEnumerator Load() { lightWhooshes = new GojoAssets.DecodedAttackSound[3]; heavyWhooshes = new GojoAssets.DecodedAttackSound[3]; meleeLight = new GojoAssets.DecodedAttackSound[3]; meleeHeavy = new GojoAssets.DecodedAttackSound[3]; slashes = new GojoAssets.DecodedAttackSound[6]; for (int i = 0; i < 3; i++) { lightWhooshes[i] = GojoAssets.LoadSound($"sfx/swish-light-{i + 1}.wav", 0.14f, "Jujutsu SFX"); yield return null; heavyWhooshes[i] = GojoAssets.LoadSound($"sfx/swish-heavy-{i + 1}.wav", 0.16f, "Jujutsu SFX"); yield return null; meleeLight[i] = GojoAssets.LoadSound($"sfx/swish-light-{i + 1}.wav", 1f, "Jujutsu melee"); yield return null; meleeHeavy[i] = GojoAssets.LoadSound($"sfx/swish-heavy-{i + 1}.wav", 1f, "Jujutsu melee"); yield return null; } for (int i = 0; i < slashes.Length; i++) { slashes[i] = GojoAssets.LoadSound($"sfx/blade-cut-{i + 1}.wav", 1f, "Jujutsu SFX"); yield return null; } blackFlash = new GojoAssets.DecodedAttackSound[meleeHeavy.Length]; for (int i = 0; i < blackFlash.Length; i++) { blackFlash[i] = PitchDown(meleeHeavy[i], 0.5f); yield return null; } } private static GojoAssets.DecodedAttackSound PitchDown(GojoAssets.DecodedAttackSound source, float rateScale) { if (source == null || source.Samples == null || source.SampleRate <= 0) { return null; } return new GojoAssets.DecodedAttackSound { Name = source.Name + " (black flash)", Samples = source.Samples, Channels = source.Channels, SampleRate = Mathf.Max(1, Mathf.RoundToInt((float)source.SampleRate * rateScale)), FrameCount = source.FrameCount }; } internal static void PlayBlackFlash(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GojoAssets.PlayRandomSound(blackFlash, position, 0.12f, 0f, "Jujutsu melee"); } internal static NativePcmPlayer.PlaybackHandle PlayMeleeLight(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return GojoAssets.PlayRandomSound(meleeLight, position, 0.01f, 0.035f, "Jujutsu melee"); } internal static void PlayMeleeHeavy(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GojoAssets.PlayRandomSound(meleeHeavy, position, 0.01f, 0.06f, "Jujutsu melee"); } internal static void PlayLightWhoosh(Vector3 position, float volume = 0.72f) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GojoAssets.PlayRandomSound(lightWhooshes, position, volume, 0.035f, "Jujutsu SFX"); } internal static void PlaySlashVariant(int variant, Vector3 position, float volume = 0.55f) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (slashes != null && slashes.Length != 0) { int num = (variant % slashes.Length + slashes.Length) % slashes.Length; GojoAssets.PlayAttackSound(slashes[num], position, Mathf.Min(volume, 0.01f), 0.015f, "Jujutsu SFX"); } } internal static void PlayHeavyWhoosh(Vector3 position, float volume = 0.82f) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GojoAssets.PlayRandomSound(heavyWhooshes, position, volume, 0.045f, "Jujutsu SFX"); } internal static void PlaySlash(Vector3 position, float volume = 0.78f) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GojoAssets.PlayRandomSound(slashes, position, Mathf.Min(volume, 0.01f), 0.025f, "Jujutsu SFX"); } } internal static class JujutsuStartup { internal static MonoBehaviour Host { get; private set; } internal static int FailedSteps { get; private set; } internal static void UseHost(MonoBehaviour host) { if (!Object.op_Implicit((Object)(object)Host)) { Host = host; } } internal static void Step(string name, Action action) { try { action(); } catch (Exception arg) { FailedSteps++; Plugin.Log.LogError((object)("The " + name + " step failed and has been skipped; the rest " + $"of the mod is loading without it: {arg}")); } } internal static void Step(string name, Func routine) { Step(name, delegate { if (!Object.op_Implicit((Object)(object)Host)) { throw new InvalidOperationException("no plugin is available to run coroutines on"); } Host.StartCoroutine(routine()); }); } internal static void Survivor(string name, Action action) { JujutsuContentPack.Mark mark = JujutsuContentPack.MarkContent(); try { action(); } catch (Exception arg) { FailedSteps++; string text = JujutsuContentPack.RollBackTo(mark); Plugin.Log.LogError((object)(name + " could not be built and will not appear in the character select; the other survivors are loading without him" + ((text == null) ? ". Nothing of his had been registered yet" : (". His " + text + " were taken back out of the content pack")) + $": {arg}")); } } } internal static class ModOptions { internal const string PluginGuid = "com.rune580.riskofoptions"; internal static void Apply() { if (!Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { Plugin.Log.LogInfo((object)"RiskOfOptions is not installed, so the settings stay in the config file. Install Rune580-Risk_Of_Options to get them on the Mod Options page."); return; } try { Register(); Plugin.Log.LogInfo((object)"Settings registered with RiskOfOptions; they are under Mod Options as \"Satoru Gojo\"."); } catch (Exception ex) { Plugin.Log.LogWarning((object)("RiskOfOptions is installed but the settings could not be registered, so they stay in the config file only: " + ex)); } } private static void Register() { ModSettingsManager.SetModDescription("Satoru Gojo, Ryomen Sukuna, Yuji Itadori and Aoi Todo as playable survivors."); Bind(JujutsuConfig.SideSkill1Key); Bind(JujutsuConfig.SideSkill2Key); Bind(JujutsuConfig.DomainKey); Slider(JujutsuConfig.ModVolume, 0f, 5f, 0.05f); Slider(JujutsuConfig.VoiceVolume, 0f, 4f, 0.05f); Slider(JujutsuConfig.ThemeVolume, 0f, 2f, 0.02f); Check(JujutsuConfig.FollowGameVolume); Slider(JujutsuConfig.GojoOutfitHandSideways, -0.2f, 0.2f, 0.005f); } private static void Slider(ConfigEntry entry, float minimum, float maximum, float increment) { //IL_0005: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (entry != null) { ModSettingsManager.AddOption((BaseOption)new StepSliderOption(entry, new StepSliderConfig { min = minimum, max = maximum, increment = increment })); } } private static void Bind(ConfigEntry entry) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown if (entry != null) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry)); } } private static void Check(ConfigEntry entry) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown if (entry != null) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry)); } } } internal static class NativePcmPlayer { internal sealed class PlaybackHandle { private volatile bool stopRequested; internal bool StopRequested => stopRequested; internal void RequestStop() { stopRequested = true; } } private struct WaveFormat { internal ushort FormatTag; internal ushort Channels; internal uint SamplesPerSecond; internal uint AverageBytesPerSecond; internal ushort BlockAlign; internal ushort BitsPerSample; internal ushort ExtraSize; } private struct WaveHeader { internal IntPtr Data; internal uint BufferLength; internal uint BytesRecorded; internal IntPtr User; internal uint Flags; internal uint Loops; internal IntPtr Next; internal IntPtr Reserved; } private const uint WaveMapper = uint.MaxValue; private const uint WhdrDone = 1u; private const uint MmsysNoError = 0u; private const uint WaveStillPlaying = 33u; private const int MaximumConcurrentVoices = 8; private static int activeVoices; private static PlaybackHandle currentSpokenLine; internal static PlaybackHandle Play(float[] samples, int channels, int sampleRate, float volume, float pan, bool spokenLine = false) { PlaybackHandle playbackHandle = new PlaybackHandle(); if (spokenLine) { Interlocked.Exchange(ref currentSpokenLine, playbackHandle)?.RequestStop(); } if (!StartVoice(samples, channels, sampleRate, volume, pan, playbackHandle, spokenLine)) { return null; } return playbackHandle; } internal static PlaybackHandle PlayTrack(float[] samples, int channels, int sampleRate, float volume, int startFrame = 0) { PlaybackHandle playbackHandle = new PlaybackHandle(); if (!StartVoice(samples, channels, sampleRate, volume, 0f, playbackHandle, ownsSpokenLineSlot: false, startFrame, music: true)) { return null; } return playbackHandle; } private static bool StartVoice(float[] samples, int channels, int sampleRate, float volume, float pan, PlaybackHandle handle, bool ownsSpokenLineSlot, int startFrame = 0, bool music = false) { volume = (music ? GameVolume.ScaleMusic(volume) : GameVolume.ScaleSfx(volume)); if (samples == null || samples.Length == 0 || channels <= 0 || sampleRate <= 0 || volume <= 0.001f) { return false; } if (Interlocked.Increment(ref activeVoices) > 8) { Interlocked.Decrement(ref activeVoices); return false; } byte[] pcm = BuildStereoPcm16(samples, channels, volume, pan, startFrame); int durationMilliseconds = Mathf.CeilToInt((float)pcm.Length / 4f / (float)sampleRate * 1000f); Thread thread = new Thread((ThreadStart)delegate { try { PlayWorker(pcm, sampleRate, durationMilliseconds, handle); } finally { if (ownsSpokenLineSlot && handle != null) { Interlocked.CompareExchange(ref currentSpokenLine, null, handle); } Interlocked.Decrement(ref activeVoices); } }); thread.IsBackground = true; thread.Name = "JujutsuPcmVoice"; thread.Start(); return true; } private static byte[] BuildStereoPcm16(float[] samples, int channels, float volume, float pan, int startFrame) { int num = samples.Length / channels; int num2 = Mathf.Clamp(startFrame, 0, num); int num3 = num - num2; byte[] array = new byte[num3 * 4]; float num4 = Mathf.Clamp(pan, -1f, 1f); float num5 = volume * ((num4 > 0f) ? (1f - num4 * 0.72f) : 1f); float num6 = volume * ((num4 < 0f) ? (1f + num4 * 0.72f) : 1f); for (int i = 0; i < num3; i++) { int num7 = (num2 + i) * channels; float num8 = samples[num7]; float num9 = ((channels > 1) ? samples[num7 + 1] : num8); short num10 = FloatToPcm16(num8 * num5); short num11 = FloatToPcm16(num9 * num6); int num12 = i * 4; array[num12] = (byte)(num10 & 0xFF); array[num12 + 1] = (byte)((num10 >> 8) & 0xFF); array[num12 + 2] = (byte)(num11 & 0xFF); array[num12 + 3] = (byte)((num11 >> 8) & 0xFF); } return array; } private static short FloatToPcm16(float sample) { float num = Mathf.Clamp(sample, -1f, 1f); return (short)Mathf.RoundToInt((num < 0f) ? (num * 32768f) : (num * 32767f)); } private static void PlayWorker(byte[] pcm, int sampleRate, int durationMilliseconds, PlaybackHandle handle) { IntPtr waveOut = IntPtr.Zero; IntPtr intPtr = IntPtr.Zero; IntPtr intPtr2 = IntPtr.Zero; int num = Marshal.SizeOf(); try { WaveFormat format = new WaveFormat { FormatTag = 1, Channels = 2, SamplesPerSecond = (uint)sampleRate, AverageBytesPerSecond = (uint)(sampleRate * 4), BlockAlign = 4, BitsPerSample = 16, ExtraSize = 0 }; uint num2 = WaveOutOpen(out waveOut, new IntPtr(-1), ref format, IntPtr.Zero, IntPtr.Zero, 0u); if (num2 != 0) { Plugin.Log.LogError((object)$"waveOutOpen failed with code {num2}."); return; } intPtr = Marshal.AllocHGlobal(pcm.Length); Marshal.Copy(pcm, 0, intPtr, pcm.Length); WaveHeader structure = new WaveHeader { Data = intPtr, BufferLength = (uint)pcm.Length }; intPtr2 = Marshal.AllocHGlobal(num); Marshal.StructureToPtr(structure, intPtr2, fDeleteOld: false); num2 = WaveOutPrepareHeader(waveOut, intPtr2, (uint)num); if (num2 != 0) { Plugin.Log.LogError((object)$"waveOutPrepareHeader failed with code {num2}."); return; } num2 = WaveOutWrite(waveOut, intPtr2, (uint)num); if (num2 != 0) { Plugin.Log.LogError((object)$"waveOutWrite failed with code {num2}."); return; } int i = 0; for (int num3 = Math.Max(1500, durationMilliseconds + 3000); i < num3; i += 10) { if ((Marshal.PtrToStructure(intPtr2).Flags & 1) != 0) { break; } if (handle != null && handle.StopRequested) { break; } Thread.Sleep(10); } } catch (ThreadAbortException) { } catch (Exception arg) { Plugin.Log.LogError((object)$"Native PCM playback failed: {arg}"); } finally { if (waveOut != IntPtr.Zero) { WaveOutReset(waveOut); if (intPtr2 != IntPtr.Zero) { int num4 = 0; uint num5; do { num5 = WaveOutUnprepareHeader(waveOut, intPtr2, (uint)num); if (num5 == 33) { Thread.Sleep(10); } num4++; } while (num5 == 33 && num4 < 100); } WaveOutClose(waveOut); } if (intPtr2 != IntPtr.Zero) { Marshal.FreeHGlobal(intPtr2); } if (intPtr != IntPtr.Zero) { Marshal.FreeHGlobal(intPtr); } } } [DllImport("winmm.dll", EntryPoint = "waveOutOpen")] private static extern uint WaveOutOpen(out IntPtr waveOut, IntPtr deviceId, ref WaveFormat format, IntPtr callback, IntPtr instance, uint flags); [DllImport("winmm.dll", EntryPoint = "waveOutPrepareHeader")] private static extern uint WaveOutPrepareHeader(IntPtr waveOut, IntPtr header, uint headerSize); [DllImport("winmm.dll", EntryPoint = "waveOutWrite")] private static extern uint WaveOutWrite(IntPtr waveOut, IntPtr header, uint headerSize); [DllImport("winmm.dll", EntryPoint = "waveOutUnprepareHeader")] private static extern uint WaveOutUnprepareHeader(IntPtr waveOut, IntPtr header, uint headerSize); [DllImport("winmm.dll", EntryPoint = "waveOutReset")] private static extern uint WaveOutReset(IntPtr waveOut); [DllImport("winmm.dll", EntryPoint = "waveOutClose")] private static extern uint WaveOutClose(IntPtr waveOut); } internal static class StatText { internal static string Percent(float coefficient) { return Number(coefficient * 100f) + "%"; } internal static string Fraction(float fraction) { return Number(fraction * 100f) + "%"; } internal static string Metres(float value) { return Number(value) + "m"; } internal static string Seconds(float value) { return Number(value); } internal static string Number(float value) { return value.ToString("0.##", CultureInfo.InvariantCulture); } internal static string Damage(string text) { return "" + text + ""; } internal static string Utility(string text) { return "" + text + ""; } internal static string Healing(string text) { return "" + text + ""; } internal static string Health(string text) { return "" + text + ""; } internal static string Sub(string text) { return "" + text + ""; } } } namespace GojoSatoruMod.Components { internal static class BlackFlash { internal readonly struct Prepared { internal bool Landed { get; } internal float Multiplier { get; } internal Prepared(bool landed, float multiplier) { Landed = landed; Multiplier = multiplier; } } private const int Bolts = 7; private const float BoltReach = 2.6f; private const int BoltSegments = 3; private const float BoltLifetime = 0.22f; internal static float Multiplier => Mathf.Max(1f, JujutsuConfig.BlackFlashMultiplier.Value); internal static Prepared Roll(float chanceScale) { float num = Mathf.Clamp01(JujutsuConfig.BlackFlashChance.Value * 0.01f * Mathf.Max(0f, chanceScale)); if (num <= 0f || Random.value >= num) { return new Prepared(landed: false, 1f); } return new Prepared(landed: true, Mathf.Max(1f, JujutsuConfig.BlackFlashMultiplier.Value)); } internal static void Announce(Vector3 position, string character) { //IL_0000: 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) JujutsuSfxAssets.PlayBlackFlash(position); Speak(position, character); } private static void Speak(Vector3 position, string character) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) JujutsuCharacters.For(character)?.FlashVoice?.Invoke(position); } internal static void Land(Vector3 position) { //IL_0000: 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) PlayBurst(position); JujutsuSfxAssets.PlayMeleeHeavy(position); } internal static bool TryProc(Vector3 impactPosition, out float damageMultiplier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return TryProc(impactPosition, 1f, "Gojo", out damageMultiplier); } internal static bool TryProc(Vector3 impactPosition, float chanceScale, string character, out float damageMultiplier, bool withEffect = true) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) damageMultiplier = 1f; float num = Mathf.Clamp01(JujutsuConfig.BlackFlashChance.Value * 0.01f * Mathf.Max(0f, chanceScale)); if (num <= 0f || Random.value >= num) { return false; } damageMultiplier = Mathf.Max(1f, JujutsuConfig.BlackFlashMultiplier.Value); if (withEffect) { PlayEffect(impactPosition, character); } return true; } private static void PlayBurst(Vector3 position) { //IL_0000: 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_001b: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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) JujutsuFxShake.BlackFlash(position); GojoTechniqueVisuals.CreateBurst(position, new Color(0.02f, 0f, 0.03f, 1f), 4.2f, 0.45f, GojoTechniqueStyle.Purple); GojoTechniqueVisuals.CreateBurst(position, new Color(0.85f, 0.05f, 0.12f, 1f), 2.4f, 0.3f, GojoTechniqueStyle.Red); PlayLightning(position); BlackFlashText.Play(position); } private static void PlayLightning(Vector3 position) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_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) Color color = default(Color); ((Color)(ref color))..ctor(0.18f, 0f, 0.04f, 1f); for (int i = 0; i < 7; i++) { Vector3 val = Random.onUnitSphere; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.up; } ((Vector3)(ref val)).Normalize(); val.y = Mathf.Abs(val.y) * 0.6f + 0.25f; ((Vector3)(ref val)).Normalize(); Vector3 start = position; for (int j = 1; j <= 3; j++) { float num = 2.6f * (float)j / 3f; Vector3 val2 = position + val * num; if (j < 3) { val2 += Random.onUnitSphere * 0.468f; } float num2 = 1f - (float)(j - 1) / 3f * 0.55f; SukunaVisuals.CreateSlash(start, val2, 0.16f * num2, 0.22f, color, withLight: false); start = val2; } } } private static void PlayEffect(Vector3 position, string character) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) PlayBurst(position); JujutsuSfxAssets.PlayMeleeHeavy(position); JujutsuSfxAssets.PlayBlackFlash(position); Speak(position, character); } } internal sealed class BlueFieldController : MonoBehaviour { internal const float FieldDuration = 2.4f; private const float MinimumFieldRadius = 7.5f; private const float MaximumFieldRadius = 29f; private const float TickInterval = 0.15f; private readonly HashSet victims = new HashSet(); private CharacterBody body; private RuntimeOrbVisual fieldVisual; private GojoCollapseVisual fieldEnergyVisual; private Vector3 fieldPosition; private float damageStat; private float fieldRadius; private float damageMultiplier; private float pullMultiplier; private float visualRadius; private float age; private float tickStopwatch; private bool crit; private bool active; private void Awake() { body = ((Component)this).GetComponent(); } internal void Activate(Vector3 position, float ownerDamageStat, bool isCrit, float overchargeFraction) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) StopField(burst: false); float num = Mathf.Clamp01(overchargeFraction); fieldPosition = position; damageStat = ownerDamageStat; fieldRadius = Mathf.Lerp(7.5f, 29f, num); damageMultiplier = Mathf.Lerp(1f, 2.5f, num); pullMultiplier = Mathf.Lerp(0.75f, 2.75f, num); visualRadius = fieldRadius * 0.3f; crit = isCrit; age = 0f; tickStopwatch = 0.15f; active = true; fieldVisual = RuntimeVisuals.CreateOrb(fieldPosition, GojoAssets.Blue, visualRadius, 0f, GojoTechniqueStyle.Blue); fieldEnergyVisual = GojoEffects.Collapse(fieldPosition, GojoAssets.Blue, fieldRadius, 2.4f); } private void FixedUpdate() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!active) { return; } age += Time.fixedDeltaTime; if (Object.op_Implicit((Object)(object)fieldVisual)) { fieldVisual.SetPosition(fieldPosition); fieldVisual.SetRadius(visualRadius + Mathf.Sin(age * 9f) * visualRadius * 0.13f); } tickStopwatch += Time.fixedDeltaTime; if (tickStopwatch >= 0.15f) { tickStopwatch -= 0.15f; if (NetworkServer.active) { DamageAndPull(); } } if (age >= 2.4f) { StopField(burst: true); } } private void DamageAndPull() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_015c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return; } victims.Clear(); Collider[] colliders; int num = GojoDamageUtility.OverlapEnemiesNonAlloc(fieldPosition, fieldRadius, out colliders); TeamIndex ownerTeam = (TeamIndex)((!Object.op_Implicit((Object)(object)body.teamComponent)) ? (-1) : ((int)body.teamComponent.teamIndex)); float damage = damageStat * JujutsuConfig.BlueDamagePerTick.Value * damageMultiplier; for (int i = 0; i < num; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(colliders[i], ownerTeam, victims); if (!Object.op_Implicit((Object)(object)val)) { continue; } Vector3 val2 = fieldPosition - val.body.corePosition; float num2 = Mathf.Max(1f, ((Vector3)(ref val2)).magnitude); Vector3 val3 = ((Vector3)(ref val2)).normalized * Mathf.Lerp(850f, 2400f, Mathf.Clamp01(num2 / fieldRadius)) * pullMultiplier; CharacterMotor characterMotor = val.body.characterMotor; if (Object.op_Implicit((Object)(object)characterMotor)) { characterMotor.disableAirControlUntilCollision = true; if (characterMotor.isGrounded && val2.y > 0f) { ((BaseCharacterController)characterMotor).Motor.ForceUnground(0.1f); val3 += Vector3.up * 450f * pullMultiplier; } } GojoDamageUtility.ApplyDamage(((Component)this).gameObject, val, damage, val3, crit, 0.2f, DamageTypeCombo.GenericSecondary, (DamageColorIndex)0); } } private void StopField(bool burst) { active = false; if (Object.op_Implicit((Object)(object)fieldVisual)) { if (burst) { fieldVisual.BurstAndDestroy(0.1f, 0.35f); } else { Object.Destroy((Object)(object)((Component)fieldVisual).gameObject); } fieldVisual = null; } if (Object.op_Implicit((Object)(object)fieldEnergyVisual)) { Object.Destroy((Object)(object)((Component)fieldEnergyVisual).gameObject); fieldEnergyVisual = null; } } private void OnDisable() { StopField(burst: false); } } internal sealed class CursedEnergyBar : MonoBehaviour { private const float Width = 260f; private const float Height = 20f; private const float LiftAboveSkills = 96f; private static bool hooked; private static bool reportedAnchor; private static TMP_FontAsset cachedFont; private HUD hud; private RectTransform fill; private TextMeshProUGUI valueLabel; private CanvasGroup group; private CursedEnergyController energy; internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!hooked) { hooked = true; HUD.Awake += new hook_Awake(Attach); } } private static void Attach(orig_Awake original, HUD self) { original.Invoke(self); if (!Object.op_Implicit((Object)(object)self)) { return; } try { Build(self); } catch (Exception ex) { Plugin.Log.LogError((object)("Cursed energy bar could not be built: " + ex)); } } private static void Build(HUD hud) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0056: 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_0080: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_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_0133: 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_0151: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_0180: 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_01aa: 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_01d4: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) Transform val = JujutsuHudAnchor.Find(hud, ref reportedAnchor); GameObject val2 = new GameObject("JujutsuCursedEnergyBar", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent(val, false); val3.anchorMin = new Vector2(1f, 0f); val3.anchorMax = new Vector2(1f, 0f); val3.pivot = new Vector2(1f, 0f); val3.sizeDelta = new Vector2(260f, 20f); val3.anchoredPosition = new Vector2(0f, 96f); CursedEnergyBar cursedEnergyBar = val2.AddComponent(); cursedEnergyBar.hud = hud; cursedEnergyBar.group = val2.GetComponent(); cursedEnergyBar.group.blocksRaycasts = false; cursedEnergyBar.group.interactable = false; AddImage(val3, "Background", new Color(0.025f, 0.005f, 0.04f, 0.94f), Vector2.zero, Vector2.one, Vector2.zero); RectTransform val4 = (RectTransform)AddImage(val3, "Fill", new Color(0.55f, 0.12f, 0.85f, 1f), new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(-6f, -6f)).transform; val4.pivot = new Vector2(0f, 0.5f); val4.anchorMin = new Vector2(0f, 0.5f); val4.anchorMax = new Vector2(0f, 0.5f); val4.sizeDelta = new Vector2(254f, 14f); val4.anchoredPosition = new Vector2(3f, 0f); cursedEnergyBar.fill = val4; cursedEnergyBar.valueLabel = AddText(val3, "Value", 13f); ((TMP_Text)cursedEnergyBar.valueLabel).alignment = (TextAlignmentOptions)514; TextMeshProUGUI obj = AddText(val3, "Title", 11f); ((TMP_Text)obj).text = "CURSED ENERGY"; ((Graphic)obj).color = new Color(0.86f, 0.7f, 1f, 1f); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.pivot = new Vector2(0.5f, 0f); rectTransform.sizeDelta = new Vector2(0f, 16f); rectTransform.anchoredPosition = Vector2.zero; Plugin.Log.LogInfo((object)"Cursed energy bar built as a HUD element; the IMGUI version is gone."); } private static GameObject AddImage(RectTransform parent, string name, Color colour, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = anchorMin; val2.anchorMax = anchorMax; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; val2.sizeDelta = sizeDelta; Image obj = val.AddComponent(); ((Graphic)obj).color = colour; ((Graphic)obj).raycastTarget = false; return val; } private static TextMeshProUGUI AddText(RectTransform parent, string name, float size) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; TextMeshProUGUI val3 = val.AddComponent(); ((TMP_Text)val3).fontSize = size; ((Graphic)val3).color = Color.white; ((TMP_Text)val3).fontStyle = (FontStyles)1; ((Graphic)val3).raycastTarget = false; ((TMP_Text)val3).enableWordWrapping = false; TMP_FontAsset val4 = FindFont(); if (Object.op_Implicit((Object)(object)val4)) { ((TMP_Text)val3).font = val4; } return val3; } private static TMP_FontAsset FindFont() { if (Object.op_Implicit((Object)(object)cachedFont)) { return cachedFont; } TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if (Object.op_Implicit((Object)(object)array[i])) { cachedFont = array[i]; break; } } if (!Object.op_Implicit((Object)(object)cachedFont)) { Plugin.Log.LogWarning((object)"No TMP font was loaded when the cursed energy bar was built, so its numbers may not draw."); } return cachedFont; } private void Update() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)hud) ? hud.targetBodyObject : null); CursedEnergyController cursedEnergyController = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); energy = cursedEnergyController; bool flag = (Object)(object)energy != (Object)null; if (group.alpha != (flag ? 1f : 0f)) { group.alpha = (flag ? 1f : 0f); } if (flag) { float fraction = energy.Fraction; fill.sizeDelta = new Vector2(254f * fraction, 14f); ((Graphic)((Component)fill).GetComponent()).color = Color.Lerp(new Color(0.34f, 0.04f, 0.5f, 1f), new Color(0.7f, 0.2f, 1f, 1f), fraction); ((TMP_Text)valueLabel).text = Mathf.CeilToInt(energy.Current) + " / " + Mathf.CeilToInt(energy.Maximum); } } } internal static class CursedEnergyCosts { internal const float BaseMaximum = 100f; internal const float MaximumPerLevel = 11f; internal const float BasePassiveRegenerationPerSecond = 1.5f; internal const float PassiveRegenerationPerLevel = 0.16f; internal const float MeleeRestorationPerLevel = 0.05f; internal const float ProgressionPerCharacterLevel = 1.15f; internal const float KillRestore = 18f; internal const float FlightPerSecond = 4f; internal const float JabRestore = 9f; internal const float JabFinisherRestore = 14f; internal const float KickRestore = 12f; internal const float StepPass = 9f; internal const float GojoRed = 26f; internal const float GojoBlue = 22f; internal const float GojoHealing = 25f; internal const float GojoDash = 6f; internal const float SukunaTeleport = 8f; internal const float SukunaDismantle = 3f; internal const float SukunaCleave = 22f; internal const float SukunaFuga = 70f; internal const float SukunaWorldCut = 45f; } internal sealed class CursedEnergyController : MonoBehaviour { private CharacterBody body; private float cachedMaximum; internal float Current { get; private set; } internal float Maximum => CalculateMaximum(); internal float PassiveRegenerationPerSecond => 1.5f + GetLevelIndex() * 0.16f; internal float MeleeRestorationMultiplier => 1f + GetLevelIndex() * 0.05f; internal float Fraction { get { if (!(Maximum > 0f)) { return 0f; } return Mathf.Clamp01(Current / Maximum); } } private void Awake() { body = ((Component)this).GetComponent(); cachedMaximum = CalculateMaximum(); Current = cachedMaximum; } private void OnEnable() { GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeath; } private void OnDisable() { GlobalEventManager.onCharacterDeathGlobal -= OnCharacterDeath; } private void OnCharacterDeath(DamageReport report) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && report != null && !((Object)(object)report.attackerBody != (Object)(object)body) && !((Object)(object)report.victimBody == (Object)(object)body) && Util.HasEffectiveAuthority(((Component)this).gameObject)) { Restore(18f); if (body.isPlayerControlled) { JujutsuCharacters.ForBody(body)?.EffortVoice?.Invoke(body.corePosition, 0.14f); } } } private void FixedUpdate() { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && Util.HasEffectiveAuthority(((Component)this).gameObject)) { float num = CalculateMaximum(); if (num > cachedMaximum) { Current += num - cachedMaximum; } cachedMaximum = num; Current = Mathf.Min(Current, cachedMaximum); Restore(PassiveRegenerationPerSecond * Time.fixedDeltaTime); } } internal void AcceptReported(float reported) { if (!float.IsNaN(reported)) { Current = Mathf.Clamp(reported, 0f, CalculateMaximum()); } } internal bool CanSpend(float amount) { if (!(amount <= 0f)) { return Current + 0.001f >= amount; } return true; } internal bool TrySpend(float amount) { amount = Mathf.Max(0f, amount); if (!CanSpend(amount)) { return false; } Current = Mathf.Max(0f, Current - amount); return true; } internal bool Drain(float amount) { amount = Mathf.Max(0f, amount); if (Current <= 0f) { Current = 0f; return false; } Current = Mathf.Max(0f, Current - amount); return Current > 0f; } internal void Restore(float amount) { if (!(amount <= 0f)) { Current = Mathf.Min(Maximum, Current + amount); } } internal void RestoreFromMelee(float baseAmount) { Restore(Mathf.Max(0f, baseAmount) * MeleeRestorationMultiplier); } private float CalculateMaximum() { return 100f + GetLevelIndex() * 11f; } private float GetLevelIndex() { if (!Object.op_Implicit((Object)(object)body)) { return 0f; } return Mathf.Max(0f, body.level - 1f) * 1.15f; } } public class CursedEnergySkillDef : SkillDef { public float energyCost; public float energyCostFraction; public override bool CanExecute(GenericSkill skillSlot) { if (((SkillDef)this).CanExecute(skillSlot)) { return HasEnoughEnergy(skillSlot); } return false; } public override bool IsReady(GenericSkill skillSlot) { if (((SkillDef)this).IsReady(skillSlot)) { return HasEnoughEnergy(skillSlot); } return false; } public override void OnExecute(GenericSkill skillSlot) { CursedEnergyController cursedEnergyController = FindEnergy(skillSlot); if (Object.op_Implicit((Object)(object)cursedEnergyController) && cursedEnergyController.TrySpend(GetCost(cursedEnergyController))) { ((SkillDef)this).OnExecute(skillSlot); } } private float GetCost(CursedEnergyController energy) { if (!(energyCostFraction > 0f) || !Object.op_Implicit((Object)(object)energy)) { return energyCost; } return energy.Maximum * energyCostFraction; } private bool HasEnoughEnergy(GenericSkill skillSlot) { CursedEnergyController cursedEnergyController = FindEnergy(skillSlot); if (Object.op_Implicit((Object)(object)cursedEnergyController)) { return cursedEnergyController.CanSpend(GetCost(cursedEnergyController)); } return false; } private static CursedEnergyController FindEnergy(GenericSkill skillSlot) { if (!Object.op_Implicit((Object)(object)skillSlot) || !Object.op_Implicit((Object)(object)skillSlot.characterBody)) { return null; } return ((Component)skillSlot.characterBody).GetComponent(); } } public sealed class GroundedCursedEnergySkillDef : CursedEnergySkillDef { public override bool CanExecute(GenericSkill skillSlot) { if (base.CanExecute(skillSlot)) { return IsGrounded(skillSlot); } return false; } public override bool IsReady(GenericSkill skillSlot) { if (base.IsReady(skillSlot)) { return IsGrounded(skillSlot); } return false; } private static bool IsGrounded(GenericSkill skillSlot) { CharacterBody val = (Object.op_Implicit((Object)(object)skillSlot) ? skillSlot.characterBody : null); CharacterMotor val2 = (Object.op_Implicit((Object)(object)val) ? val.characterMotor : null); if (Object.op_Implicit((Object)(object)val2)) { return val2.isGrounded; } return false; } } internal sealed class CursedEnergySync : MonoBehaviour { private const float SendInterval = 0.25f; private const float MinimumChange = 1.5f; private CharacterBody body; private CursedEnergyController energy; private float lastSentAt = -1000f; private float lastSentValue = float.NaN; private bool logged; internal static void Initialize() { NetworkingAPI.RegisterMessageType(); } private void Awake() { body = ((Component)this).GetComponent(); energy = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)energy) || NetworkServer.active || !Util.HasEffectiveAuthority(((Component)this).gameObject)) { return; } float current = energy.Current; if (!(Time.time - lastSentAt < 0.25f) && (float.IsNaN(lastSentValue) || !(Mathf.Abs(current - lastSentValue) < 1.5f))) { lastSentAt = Time.time; lastSentValue = current; if (!logged) { logged = true; Plugin.Log.LogInfo((object)($"Cursed energy: first report for netId {((NetworkBehaviour)body).netId} at " + $"{current:0.0}.")); } NetMessageExtensions.Send((INetMessage)(object)new CursedEnergyMessage(((NetworkBehaviour)body).netId, current), (NetworkDestination)2); } } } public sealed class CursedEnergyMessage : INetMessage, ISerializableObject { private NetworkInstanceId bodyId; private float current; public CursedEnergyMessage() { } public CursedEnergyMessage(NetworkInstanceId bodyId, float current) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.bodyId = bodyId; this.current = current; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyId); writer.Write(current); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) bodyId = reader.ReadNetworkId(); current = reader.ReadSingle(); } public void OnReceived() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { GameObject val = Util.FindNetworkObject(bodyId); CursedEnergyController cursedEnergyController = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (Object.op_Implicit((Object)(object)cursedEnergyController)) { cursedEnergyController.AcceptReported(current); } } } } internal static class DisplaySoundSilencer { internal static void Apply(GameObject prefab, string ownerName) { if (!Object.op_Implicit((Object)(object)prefab)) { return; } int num = 0; AudioSource[] componentsInChildren = prefab.GetComponentsInChildren(true); foreach (AudioSource val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { val.playOnAwake = false; val.mute = true; ((Behaviour)val).enabled = false; num++; } } int num2 = 0; FootstepHandler[] componentsInChildren2 = prefab.GetComponentsInChildren(true); foreach (FootstepHandler val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2)) { val2.baseFootstepString = string.Empty; val2.sprintFootstepOverrideString = string.Empty; val2.baseFootliftString = string.Empty; val2.sprintFootliftOverrideString = string.Empty; num2++; } } int num3 = 0; Component[] componentsInChildren3 = prefab.GetComponentsInChildren(true); foreach (Component val3 in componentsInChildren3) { if (Object.op_Implicit((Object)(object)val3) && string.Equals(((object)val3).GetType().Name, "AnimationEvents", StringComparison.Ordinal)) { Object.DestroyImmediate((Object)(object)val3); num3++; } } Plugin.Log.LogInfo((object)($"{ownerName} display silenced: {num} audio " + $"source(s) muted, {num2} footstep handler(s) " + $"emptied, {num3} animation-event receiver(s) " + "removed. Remaining sound-capable components: " + DescribeRemaining(prefab) + ".")); } private static string DescribeRemaining(GameObject prefab) { SortedSet sortedSet = new SortedSet(StringComparer.Ordinal); Component[] componentsInChildren = prefab.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { string name = ((object)val).GetType().Name; if (name.IndexOf("Sound", StringComparison.Ordinal) >= 0 || name.IndexOf("Audio", StringComparison.Ordinal) >= 0 || name.IndexOf("Voice", StringComparison.Ordinal) >= 0 || name.IndexOf("Ak", StringComparison.Ordinal) == 0 || name.IndexOf("AnimationEvents", StringComparison.Ordinal) >= 0) { sortedSet.Add(name); } } } if (sortedSet.Count != 0) { return string.Join(", ", new List(sortedSet).ToArray()); } return "none"; } } internal sealed class DomainFieldController : MonoBehaviour { internal const float Radius = 32f; internal const float Duration = 13f; private const float TickInterval = 0.4f; private readonly HashSet victims = new HashSet(); private CharacterBody body; private RuntimeDomainVisual visual; private Vector3 center; private float damageStat; private float remaining; private float tickStopwatch; private float themeDelay; private bool themePending; internal bool IsActive => remaining > 0f; private void Awake() { body = ((Component)this).GetComponent(); } internal void Activate(Vector3 worldCenter, float ownerDamageStat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) center = worldCenter; damageStat = ownerDamageStat; remaining = 13f; tickStopwatch = 0.4f; DomainMusic.Open(this); themeDelay = 0f; themePending = true; if (Object.op_Implicit((Object)(object)visual)) { Object.Destroy((Object)(object)((Component)visual).gameObject); } visual = RuntimeVisuals.CreateDomain(center, 32f, 13f, GojoAssets.DomainGlow, GojoAssets.DomainVoid); JujutsuFxShake.Domain(center, 32f); } private void FixedUpdate() { if (remaining <= 0f) { return; } remaining -= Time.fixedDeltaTime; tickStopwatch += Time.fixedDeltaTime; if (themePending) { themeDelay -= Time.fixedDeltaTime; if (themeDelay <= 0f) { themePending = false; DomainMusic.PlayTheme(GojoAssets.DomainTheme, DomainMusic.ThemeVolume); Plugin.Log.LogInfo((object)("Gojo domain: theme " + $"{((GojoAssets.DomainTheme != null) ? GojoAssets.DomainTheme.Duration : 0f):0.00}s " + $"started against {remaining:0.00}s of domain left.")); } } if (tickStopwatch >= 0.4f) { tickStopwatch -= 0.4f; if (NetworkServer.active) { ApplyUnlimitedVoidServer(); } } if (remaining <= 0f) { themePending = false; DomainMusic.Stop(this); if (Object.op_Implicit((Object)(object)visual)) { Object.Destroy((Object)(object)((Component)visual).gameObject); visual = null; } } } private void OnDisable() { if (remaining > 0f) { Plugin.Log.LogInfo((object)($"Gojo domain ended early with {remaining:0.00}s left: " + "the field was switched off rather than timing out.")); } themePending = false; remaining = 0f; DomainMusic.Stop(this); if (Object.op_Implicit((Object)(object)visual)) { Object.Destroy((Object)(object)((Component)visual).gameObject); visual = null; } } private void ApplyUnlimitedVoidServer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) victims.Clear(); Collider[] colliders; int num = GojoDamageUtility.OverlapEnemiesNonAlloc(center, 32f, out colliders); TeamIndex ownerTeam = (TeamIndex)((!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.teamComponent)) ? (-1) : ((int)body.teamComponent.teamIndex)); for (int i = 0; i < num; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(colliders[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val)) { SetStateOnHurt.SetStunOnObject(((Component)val.body).gameObject, 0.65f); GojoDamageUtility.ApplyDamage(((Component)this).gameObject, val, damageStat * 0.22f, Vector3.zero, crit: false, 0.05f, DamageTypeCombo.GenericSpecial, (DamageColorIndex)9); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)visual)) { Object.Destroy((Object)(object)((Component)visual).gameObject); } } } internal static class GojoDashSync { internal static void Initialize() { NetworkingAPI.RegisterMessageType(); } internal static void Request(CharacterBody attacker, Vector3 centre, Vector3 facing) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)attacker) && Object.op_Implicit((Object)(object)attacker.networkIdentity)) { NetMessageExtensions.Send((INetMessage)(object)new GojoDashBlastMessage(attacker.networkIdentity.netId, centre, facing), (NetworkDestination)2); JujutsuDiagnostics.Sent("gojo-dash-blast"); } } } public sealed class GojoDashBlastMessage : INetMessage, ISerializableObject { private NetworkInstanceId attacker; private Vector3 centre; private Vector3 facing; public GojoDashBlastMessage() { } public GojoDashBlastMessage(NetworkInstanceId attacker, Vector3 centre, Vector3 facing) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) this.attacker = attacker; this.centre = centre; this.facing = facing; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) writer.Write(attacker); writer.Write(centre); writer.Write(facing); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) attacker = reader.ReadNetworkId(); centre = reader.ReadVector3(); facing = reader.ReadVector3(); } public void OnReceived() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) JujutsuDiagnostics.Sent("gojo-dash-blast RECEIVED"); if (!NetworkServer.active) { return; } GameObject val = Util.FindNetworkObject(attacker); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2)) { Vector3 val3 = val2.corePosition - centre; if (((Vector3)(ref val3)).sqrMagnitude > 4624f) { Plugin.Log.LogWarning((object)"A dash blast was asked for further from the caster than the skill reaches, and has been dropped."); } else { GojoDashState.BlastFor(val2, centre, facing); } } } } internal sealed class GojoExtraSkillHud : MonoBehaviour, IJujutsuSkillStrip { [Serializable] internal sealed class Slot { public GenericSkill Skill; public Sprite Icon; public string Bind; public string ShortName; public Color Accent; public Variant[] Variants; } [Serializable] internal sealed class Variant { public SkillDef SkillDef; public Sprite Icon; public string ShortName; } private static bool reportedMissingVariants; private CharacterBody body; private GojoSideSkillController skills; [SerializeField] private Slot[] configured; private static bool reported; private bool HasConfiguredSlots { get { if (configured != null) { return configured.Length != 0; } return false; } } public int StripSlotCount { get { if (!HasConfiguredSlots) { if (!Object.op_Implicit((Object)(object)skills)) { return 0; } return 3; } return configured.Length; } } internal void Configure(params Slot[] slots) { configured = slots; } private void Report(float x, float y, float width, float size) { if (!reported) { reported = true; Plugin.Log.LogInfo((object)($"Gojo side panel drawn at x {x:0}-{x + width:0}, y {y:0}, " + $"on a {Screen.width}x{Screen.height} screen " + $"(slot {size:0}px). Red/Blue/Domain: " + ((Object.op_Implicit((Object)(object)skills) && Object.op_Implicit((Object)(object)skills.RedSkill)) ? "yes" : "no") + "/" + ((Object.op_Implicit((Object)(object)skills) && Object.op_Implicit((Object)(object)skills.BlueSkill)) ? "yes" : "no") + "/" + ((Object.op_Implicit((Object)(object)skills) && Object.op_Implicit((Object)(object)skills.DomainSkill)) ? "yes" : "no") + ".")); } } private void Awake() { body = ((Component)this).GetComponent(); skills = ((Component)this).GetComponent(); } public JujutsuStripSlot GetStripSlot(int index) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (HasConfiguredSlots) { Slot slot = configured[index]; if (slot == null) { return default(JujutsuStripSlot); } Variant variant = Equipped(slot); return Describe(slot.Skill, variant?.Icon ?? slot.Icon, slot.Bind, variant?.ShortName ?? slot.ShortName, slot.Accent); } return index switch { 0 => Describe(skills.RedSkill, GojoAssets.RedIcon, JujutsuInput.Describe(JujutsuConfig.SideSkill1Key.Value), "RED", GojoAssets.Red), 1 => Describe(skills.BlueSkill, GojoAssets.BlueIcon, JujutsuInput.Describe(JujutsuConfig.SideSkill2Key.Value), "BLUE", GojoAssets.Blue), _ => Describe(skills.DomainSkill, GojoAssets.DomainIcon, JujutsuInput.Describe(JujutsuConfig.DomainKey.Value), "DOMAIN", GojoAssets.Purple), }; } private static Variant Equipped(Slot slot) { SkillDef val = (Object.op_Implicit((Object)(object)slot.Skill) ? slot.Skill.skillDef : null); if (!Object.op_Implicit((Object)(object)val) || slot.Variants == null) { if (Object.op_Implicit((Object)(object)val) && slot.Variants == null && (Object)(object)slot.Skill.skillFamily != (Object)null && slot.Skill.skillFamily.variants != null && slot.Skill.skillFamily.variants.Length > 1 && !reportedMissingVariants) { reportedMissingVariants = true; Plugin.Log.LogWarning((object)("Skill strip slot '" + slot.Skill.skillName + "' offers " + $"{slot.Skill.skillFamily.variants.Length} skills and " + "carries no variant table, so it will draw '" + slot.ShortName + "' whichever is equipped.")); } return null; } for (int i = 0; i < slot.Variants.Length; i++) { if (slot.Variants[i] != null && (Object)(object)slot.Variants[i].SkillDef == (Object)(object)val) { return slot.Variants[i]; } } return null; } private static JujutsuStripSlot Describe(GenericSkill skill, Sprite icon, string bind, string shortName, Color accent) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) bool flag = Object.op_Implicit((Object)(object)skill) && skill.stock > 0; float num = (Object.op_Implicit((Object)(object)skill) ? Mathf.Max(0f, skill.cooldownRemaining) : 0f); return new JujutsuStripSlot { Icon = icon, Bind = bind, ShortName = shortName, Accent = accent, Available = flag, OverlayText = (flag ? null : ((num >= 10f) ? Mathf.CeilToInt(num).ToString() : num.ToString("0.0"))), ChargeFraction = -1f, StockText = null, GaugeFraction = -1f }; } } internal sealed class GojoFaceCamera : ICameraStateProvider { private const float Distance = 4.5f; private const float HeadHeight = 0.55f; private const float BlendIn = 0.35f; private const float BlendOut = 0.3f; private const float GojoRise = 0.15f; private const float SukunaRise = 1.5f; private const float FloorClearance = 0.35f; private const float ShotFadeStart = 0.1f; private const float ShotFadeEnd = 0.4f; private const float GojoSideAngle = 0f; internal const float SukunaSideAngle = 32f; private readonly CharacterBody body; private readonly float rise; private float restoreFadeStart; private float restoreFadeEnd; private bool fadeOverridden; private readonly Vector3 ahead; private GojoFaceCamera(CharacterBody owner, Vector3 frontDirection, float riseAboveHead) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) body = owner; ahead = frontDirection; rise = riseAboveHead; } internal static GojoFaceCamera Push(CharacterBody body) { return Push(body, 0f, 0.15f); } internal static GojoFaceCamera PushHighAngle(CharacterBody body, float sideAngle) { return Push(body, sideAngle, 1.5f); } internal static GojoFaceCamera Push(CharacterBody body, float sideAngle, float riseAboveHead) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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) CameraRigController val = FindRig(body); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)("Gojo domain shot skipped on " + ((Object)body).name + ": none of " + $"{CountRigs()} camera rig(s) belongs to this body.")); return null; } CharacterDirection component = ((Component)body).GetComponent(); Vector3 val2 = (Object.op_Implicit((Object)(object)component) ? component.forward : Vector3.zero); val2.y = 0f; Vector3 val3 = body.corePosition - ((Component)val).transform.position; val3.y = 0f; Vector3 val4 = ((((Vector3)(ref val2)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val2)).normalized : ((!(((Vector3)(ref val3)).sqrMagnitude > 0.0001f)) ? Vector3.forward : ((Vector3)(ref val3)).normalized)); if (Mathf.Abs(sideAngle) > 0.01f) { val4 = Quaternion.AngleAxis(sideAngle, Vector3.up) * val4; } GojoFaceCamera gojoFaceCamera = new GojoFaceCamera(body, val4, riseAboveHead); gojoFaceCamera.restoreFadeStart = val.fadeStartDistance; gojoFaceCamera.restoreFadeEnd = val.fadeEndDistance; gojoFaceCamera.fadeOverridden = true; val.fadeStartDistance = 0.1f; val.fadeEndDistance = 0.4f; val.SetOverrideCam((ICameraStateProvider)(object)gojoFaceCamera, 0.35f); Vector3 val5 = ((((Vector3)(ref val3)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val3)).normalized : Vector3.zero); Plugin.Log.LogInfo((object)("Domain shot on " + ((Object)val).name + " for " + ((Object)body).name + ", " + $"{sideAngle:0.#}° off centre: front=" + $"({val4.x:0.##}, {val4.y:0.##}, {val4.z:0.##}) from " + (Object.op_Implicit((Object)(object)component) ? "CharacterDirection" : "camera") + ", camera-derived would have been " + $"({val5.x:0.##}, {val5.y:0.##}, {val5.z:0.##}), " + "override held=" + $"{(object)val.overrideCam == gojoFaceCamera}.")); return gojoFaceCamera; } internal void Release() { CameraRigController val = FindRig(body); if (Object.op_Implicit((Object)(object)val)) { if (fadeOverridden) { fadeOverridden = false; val.fadeStartDistance = restoreFadeStart; val.fadeEndDistance = restoreFadeEnd; } if ((object)val.overrideCam == this) { val.SetOverrideCam((ICameraStateProvider)null, 0.3f); } } } public void GetCameraState(CameraRigController cameraRigController, ref CameraState cameraState) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //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_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { Vector3 val = body.corePosition + Vector3.up * 0.55f; Vector3 val2 = val + ahead * 4.5f + Vector3.up * rise; float num = body.footPosition.y + 0.35f; if (val2.y < num) { val2.y = num; } cameraState.position = val2; cameraState.rotation = Quaternion.LookRotation(val - val2, Vector3.up); } } public bool IsUserLookAllowed(CameraRigController cameraRigController) { return false; } public bool IsUserControlAllowed(CameraRigController cameraRigController) { return false; } public bool IsHudAllowed(CameraRigController cameraRigController) { return true; } private static CameraRigController FindRig(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } ReadOnlyCollection readOnlyLocalUsersList = LocalUserManager.readOnlyLocalUsersList; if (readOnlyLocalUsersList != null) { for (int i = 0; i < readOnlyLocalUsersList.Count; i++) { LocalUser val = readOnlyLocalUsersList[i]; if (val != null && Object.op_Implicit((Object)(object)val.cameraRigController) && (Object)(object)val.cachedBody == (Object)(object)body) { return val.cameraRigController; } } } CameraRigController[] array = ((CameraRigController.readOnlyInstancesList != null) ? CameraRigController.readOnlyInstancesList.ToArray() : Array.Empty()); for (int j = 0; j < array.Length; j++) { if (Object.op_Implicit((Object)(object)array[j]) && (Object)(object)array[j].target == (Object)(object)((Component)body).gameObject) { return array[j]; } } return null; } private static int CountRigs() { if (CameraRigController.readOnlyInstancesList == null) { return 0; } return CameraRigController.readOnlyInstancesList.Count; } } internal sealed class GojoFlightController : MonoBehaviour { private const float CancelDoubleTapWindow = 0.34f; private const float RemoteHoverSpeed = 5f; private const float RemoteHoverDuration = 0.6f; private CharacterBody body; private CharacterMotor motor; private InputBankTest inputBank; private EntityStateMachine bodyStateMachine; private CursedEnergyController cursedEnergy; private bool previousJumpDown; private bool gravitySuspended; private float lastFlightJumpPress = -10f; private float remoteHoverAge; private Vector3 lastFlatAim = Vector3.forward; internal bool IsFlightActive { get; private set; } private void SuspendGravity() { if (!gravitySuspended && Object.op_Implicit((Object)(object)motor)) { gravitySuspended = true; motor.useGravity = false; } } private void RestoreGravity() { if (gravitySuspended) { gravitySuspended = false; if (Object.op_Implicit((Object)(object)motor)) { motor.useGravity = true; } } } private void UpdateRemoteEstimate() { if (motor.isGrounded) { remoteHoverAge = 0f; IsFlightActive = false; return; } if (Mathf.Abs(motor.velocity.y) < 5f) { remoteHoverAge += Time.fixedDeltaTime; } else { remoteHoverAge = 0f; } IsFlightActive = remoteHoverAge >= 0.6f; } private void StopFlight() { IsFlightActive = false; lastFlightJumpPress = -10f; RestoreGravity(); } private void OnDisable() { RestoreGravity(); } private Vector3 ResolveFlightDirection(Vector3 moveInput) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_001b: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) Vector3 aimDirection = inputBank.aimDirection; if (((Vector3)(ref aimDirection)).sqrMagnitude < 0.0001f) { aimDirection = lastFlatAim; } ((Vector3)(ref aimDirection)).Normalize(); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(aimDirection.x, 0f, aimDirection.z); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = lastFlatAim; } else { ((Vector3)(ref val)).Normalize(); lastFlatAim = val; } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.z, 0f, 0f - val.x); return aimDirection * Vector3.Dot(moveInput, val) + val2 * Vector3.Dot(moveInput, val2); } private void Awake() { body = ((Component)this).GetComponent(); motor = ((Component)this).GetComponent(); inputBank = ((Component)this).GetComponent(); cursedEnergy = ((Component)this).GetComponent(); bodyStateMachine = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "Body"); } private void FixedUpdate() { //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01cb: 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_0143: 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_0163: 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_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_0257: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_0283: 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_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_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_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0351: 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_0371: 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) bool flag = Object.op_Implicit((Object)(object)inputBank) && inputBank.jump.down; bool flag2 = flag && !previousJumpDown; previousJumpDown = flag; if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)motor) || !Object.op_Implicit((Object)(object)inputBank) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { StopFlight(); } else if (!Util.HasEffectiveAuthority(((Component)this).gameObject)) { UpdateRemoteEstimate(); } else { if (Object.op_Implicit((Object)(object)bodyStateMachine) && bodyStateMachine.state is InfinityState) { return; } if (motor.isGrounded) { StopFlight(); return; } if (!IsFlightActive) { if (!flag2 || !Object.op_Implicit((Object)(object)cursedEnergy) || !cursedEnergy.CanSpend(2f)) { return; } IsFlightActive = true; lastFlightJumpPress = -10f; SuspendGravity(); } else if (flag2) { float fixedTime = Time.fixedTime; if (fixedTime - lastFlightJumpPress <= 0.34f) { StopFlight(); Vector3 velocity = motor.velocity; velocity.y = Mathf.Min(velocity.y, 0f); motor.velocity = velocity; return; } lastFlightJumpPress = fixedTime; } if (!Object.op_Implicit((Object)(object)cursedEnergy) || !cursedEnergy.Drain(4f * Time.fixedDeltaTime)) { StopFlight(); Vector3 velocity2 = motor.velocity; velocity2.y = Mathf.Min(velocity2.y, 0f); motor.velocity = velocity2; return; } float num = Mathf.Max(7f, body.moveSpeed); Vector3 moveVector = inputBank.moveVector; moveVector.y = 0f; float num2 = Mathf.Clamp01(((Vector3)(ref moveVector)).magnitude); if (((Vector3)(ref moveVector)).sqrMagnitude > 1f) { ((Vector3)(ref moveVector)).Normalize(); } bool flag3 = num2 > 0.05f; bool flag4 = flag && !flag3; bool num3 = flag && flag3; Vector3 val = (flag4 ? Vector3.zero : (ResolveFlightDirection(moveVector) * num * 2.3f)); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); Vector3 velocity3 = motor.velocity; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(velocity3.x, 0f, velocity3.z); float num4 = Mathf.Max(44f, body.acceleration * 1.1f); val3 = Vector3.MoveTowards(val3, val2, (flag4 ? (num4 * 2.6f) : num4) * Time.fixedDeltaTime); if (num3) { velocity3.y = Mathf.MoveTowards(velocity3.y, Mathf.Max(val.y, num * 1.7f), num4 * 0.8f * Time.fixedDeltaTime); } else if (flag3) { velocity3.y = Mathf.MoveTowards(velocity3.y, val.y, num4 * 0.8f * Time.fixedDeltaTime); } else { velocity3.y = 0f; } velocity3.x = val3.x; velocity3.z = val3.z; motor.velocity = velocity3; } } } internal sealed class GojoOrbCameraController : MonoBehaviour { private float pendingScrollInput; internal bool IsControllingOrb { get; private set; } internal void BeginControl() { pendingScrollInput = 0f; IsControllingOrb = true; } internal void EndControl() { IsControllingOrb = false; pendingScrollInput = 0f; } private void Update() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (IsControllingOrb && !JujutsuInput.IsBlocked) { pendingScrollInput = Mathf.Clamp(pendingScrollInput + Input.mouseScrollDelta.y, -12f, 12f); } } internal float ConsumeScrollInput() { float result = pendingScrollInput; pendingScrollInput = 0f; return result; } } internal sealed class GojoOrbSync : MonoBehaviour { private const float SendInterval = 0.1f; private CharacterBody body; private float lastSentAt = -1000f; private float lastSentDistance = float.NaN; private bool logged; private bool loggedReceive; internal float ReportedDistance { get; private set; } = float.NaN; internal static void Initialize() { NetworkingAPI.RegisterMessageType(); } private void Awake() { body = ((Component)this).GetComponent(); } internal void Report(float distance) { //IL_009d: 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) if (Object.op_Implicit((Object)(object)body) && !NetworkServer.active && (!(Time.time - lastSentAt < 0.1f) || !(Mathf.Abs(distance - lastSentDistance) < 0.25f))) { lastSentAt = Time.time; lastSentDistance = distance; if (!logged) { logged = true; Plugin.Log.LogInfo((object)($"Orb distance: first send for netId {((NetworkBehaviour)body).netId} at " + $"{distance:0.0}m.")); } NetMessageExtensions.Send((INetMessage)(object)new OrbDistanceMessage(((NetworkBehaviour)body).netId, distance), (NetworkDestination)2); JujutsuDiagnostics.Sent("orb-distance"); } } internal void Accept(float distance) { if (!loggedReceive) { loggedReceive = true; Plugin.Log.LogInfo((object)$"Orb distance: first arrival on the server, {distance:0.0}m."); } ReportedDistance = distance; } internal void Clear() { ReportedDistance = float.NaN; } internal void ReportResolved(string skill, float distance, bool authority) { Plugin.Log.LogInfo((object)($"{skill} resolving at {distance:0.0}m " + $"(authority {authority}, server {NetworkServer.active}, " + "reported " + (float.IsNaN(ReportedDistance) ? "none" : ReportedDistance.ToString("0.0")) + ").")); } } public sealed class OrbDistanceMessage : INetMessage, ISerializableObject { private NetworkInstanceId bodyId; private float distance; private bool relayed; public OrbDistanceMessage() { } public OrbDistanceMessage(NetworkInstanceId bodyId, float distance, bool relayed = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.bodyId = bodyId; this.distance = distance; this.relayed = relayed; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyId); writer.Write(distance); writer.Write(relayed); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) bodyId = reader.ReadNetworkId(); distance = reader.ReadSingle(); relayed = reader.ReadBoolean(); } public void OnReceived() { //IL_000b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) JujutsuDiagnostics.Sent("orb-distance RECEIVED"); GameObject val = Util.FindNetworkObject(bodyId); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)$"Orb distance: no networked object for {bodyId}."); return; } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { Plugin.Log.LogWarning((object)("Orb distance: " + ((Object)val).name + " has no GojoOrbSync.")); return; } float num = Mathf.Clamp(distance, 2f, 120f); val.GetComponent()?.Accept(num); if (NetworkServer.active && !relayed) { NetMessageExtensions.Send((INetMessage)(object)new OrbDistanceMessage(bodyId, num, relayed: true), (NetworkDestination)1); } } } internal sealed class GojoRigReport : MonoBehaviour { private static readonly float[] ReportTimes = new float[3] { 2f, 6f, 12f }; private static readonly HashSet auditedMeshes = new HashSet(); private static FieldInfo invisibilityCountField; private static bool invisibilityCountSearched; private float age; private int nextReport; private string lastTable; private void Update() { if (nextReport >= ReportTimes.Length) { ((Behaviour)this).enabled = false; return; } age += Time.deltaTime; if (!(age < ReportTimes[nextReport])) { nextReport++; Report(nextReport); } } private void Report(int pass) { CharacterBody component = ((Component)this).GetComponent(); ModelLocator component2 = ((Component)this).GetComponent(); Transform val = (Object.op_Implicit((Object)(object)component2) ? component2.modelTransform : null); string text = (Object.op_Implicit((Object)(object)component) ? ((Object)component).name : ((Object)this).name); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogInfo((object)($"Rig report #{pass} ({ReportTimes[pass - 1]:0.0}s) on " + text + ": no model transform.")); return; } int visibleSkinned = 0; int visibleMesh = 0; string text2 = BuildRendererTable(val, ref visibleSkinned, ref visibleMesh); if (visibleSkinned > 0) { Plugin.Log.LogInfo((object)($"Rig report #{pass} ({ReportTimes[pass - 1]:0.0}s) on " + $"{text}: {visibleSkinned} skinned renderer(s) visible, " + "SKINNED RIG IS LIVE.")); lastTable = text2; return; } Plugin.Log.LogInfo((object)($"Rig report #{pass} ({ReportTimes[pass - 1]:0.0}s) on " + text + ", model '" + ((Object)val).name + "':")); ReportCharacterModel(((Component)val).GetComponent() ?? ((Component)val).GetComponentInChildren(true)); if (text2 == lastTable) { Plugin.Log.LogInfo((object)" renderers: unchanged since the previous report."); } else { Plugin.Log.LogInfo((object)text2.TrimEnd()); } lastTable = text2; ReportWatchdogs(val); Plugin.Log.LogInfo((object)($" visible body renderers: {visibleSkinned} skinned, {visibleMesh} mesh " + "-> " + ((visibleMesh > 0) ? "STATIC FALLBACK IS LIVE" : "NOTHING IS VISIBLE - the body has no mesh on screen"))); } private static void ReportCharacterModel(CharacterModel characterModel) { if (!Object.op_Implicit((Object)(object)characterModel)) { Plugin.Log.LogInfo((object)" CharacterModel: missing."); return; } RendererInfo[] baseRendererInfos = characterModel.baseRendererInfos; Plugin.Log.LogInfo((object)(" CharacterModel on '" + ((Object)characterModel).name + "': invisibilityCount=" + ReadInvisibilityCount(characterModel) + ", " + $"materialsDirty={characterModel.materialsDirty}, " + $"baseRendererInfos={((baseRendererInfos != null) ? baseRendererInfos.Length : 0)}")); if (baseRendererInfos != null) { for (int i = 0; i < baseRendererInfos.Length; i++) { Renderer renderer = baseRendererInfos[i].renderer; Plugin.Log.LogInfo((object)($" [{i}] " + (Object.op_Implicit((Object)(object)renderer) ? ($"'{((Object)renderer).name}' enabled={renderer.enabled} " + $"active={((Component)renderer).gameObject.activeInHierarchy}") : ""))); } } } private static string ReadInvisibilityCount(CharacterModel characterModel) { if (!invisibilityCountSearched) { invisibilityCountSearched = true; invisibilityCountField = typeof(CharacterModel).GetField("invisibilityCount", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (invisibilityCountField == null) { return "n/a"; } try { return Convert.ToString(invisibilityCountField.GetValue(characterModel)); } catch (Exception ex) { return "unreadable (" + ex.GetType().Name + ")"; } } private string BuildRendererTable(Transform model, ref int visibleSkinned, ref int visibleMesh) { StringBuilder stringBuilder = new StringBuilder(); Renderer[] componentsInChildren = ((Component)model).GetComponentsInChildren(true); stringBuilder.AppendLine($" renderers under the model ({componentsInChildren.Length}):"); foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); bool flag = val is MeshRenderer; bool flag2 = val.enabled && ((Component)val).gameObject.activeInHierarchy; if (flag2 && Object.op_Implicit((Object)(object)val2)) { visibleSkinned++; } else if (flag2 && flag) { visibleMesh++; } string text = (Object.op_Implicit((Object)(object)val2) ? "SKINNED" : (flag ? "mesh " : "other ")); stringBuilder.AppendLine(" " + text + " '" + ((Object)val).name + "' " + $"enabled={val.enabled} " + $"active={((Component)val).gameObject.activeInHierarchy} " + DescribeSkin(val2) + "path=" + PathUnder(model, ((Component)val).transform)); } } return stringBuilder.ToString(); } private static string DescribeSkin(SkinnedMeshRenderer skin) { if (!Object.op_Implicit((Object)(object)skin)) { return string.Empty; } int num = ((skin.bones != null) ? skin.bones.Length : 0); Mesh sharedMesh = skin.sharedMesh; if (!Object.op_Implicit((Object)(object)sharedMesh)) { return $"bones={num} mesh= "; } int num2 = ((sharedMesh.bindposes != null) ? sharedMesh.bindposes.Length : 0); string arg = string.Empty; if (num != num2) { arg = "BONE/BINDPOSE MISMATCH "; } else if (auditedMeshes.Add(((Object)sharedMesh).GetInstanceID())) { arg = AuditWeights(sharedMesh, num); } return $"bones={num} bindposes={num2} {arg}" + "rootBone=" + (Object.op_Implicit((Object)(object)skin.rootBone) ? ((Object)skin.rootBone).name : "") + " " + $"verts={sharedMesh.vertexCount} "; } private static string AuditWeights(Mesh sharedMesh, int bones) { //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) try { BoneWeight[] boneWeights = sharedMesh.boneWeights; if (boneWeights == null || boneWeights.Length == 0) { return "NO BONE WEIGHTS "; } int num = 0; for (int i = 0; i < boneWeights.Length; i++) { BoneWeight val = boneWeights[i]; num = Mathf.Max(num, Mathf.Max(Mathf.Max(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).boneIndex1), Mathf.Max(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).boneIndex3))); } return (num >= bones) ? $"WEIGHTS REACH BONE {num} OF {bones} " : $"maxWeightBone={num} "; } catch (Exception ex) { return "weights unreadable (" + ex.GetType().Name + ") "; } } private static void ReportWatchdogs(Transform model) { GojoModelVisibilityController[] componentsInChildren = ((Component)model).GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { Plugin.Log.LogInfo((object)" GojoModelVisibilityController: none on this model."); } foreach (GojoModelVisibilityController gojoModelVisibilityController in componentsInChildren) { Plugin.Log.LogInfo((object)(" GojoModelVisibilityController on '" + ((Object)gojoModelVisibilityController).name + "': " + DescribeHost((Behaviour)(object)gojoModelVisibilityController) + ", " + gojoModelVisibilityController.DescribeState())); } GojoDefaultOutfitToggle[] componentsInChildren2 = ((Component)model).GetComponentsInChildren(true); if (componentsInChildren2.Length == 0) { Plugin.Log.LogInfo((object)" GojoDefaultOutfitToggle: none on this model."); } foreach (GojoDefaultOutfitToggle gojoDefaultOutfitToggle in componentsInChildren2) { Plugin.Log.LogInfo((object)(" GojoDefaultOutfitToggle on '" + ((Object)gojoDefaultOutfitToggle).name + "': " + DescribeHost((Behaviour)(object)gojoDefaultOutfitToggle) + ", " + gojoDefaultOutfitToggle.DescribeState())); } } private static string DescribeHost(Behaviour behaviour) { return $"component enabled={behaviour.enabled}, " + $"object active={((Component)behaviour).gameObject.activeInHierarchy}, " + "LateUpdate " + (behaviour.isActiveAndEnabled ? "running" : "NOT RUNNING"); } private static string PathUnder(Transform root, Transform leaf) { StringBuilder stringBuilder = new StringBuilder(((Object)leaf).name); Transform parent = leaf.parent; while (Object.op_Implicit((Object)(object)parent) && (Object)(object)parent != (Object)(object)root) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } } internal sealed class GojoSideSkillController : MonoBehaviour { [SerializeField] private GenericSkill redSkill; [SerializeField] private GenericSkill blueSkill; [SerializeField] private GenericSkill domainSkill; private bool previousRedHeld; private bool previousBlueHeld; private bool previousDomainHeld; private int nextPunchStep; private float lastPunchStepAt = -100f; internal bool RedHeld { get; private set; } internal bool BlueHeld { get; private set; } internal GenericSkill RedSkill => redSkill; internal GenericSkill BlueSkill => blueSkill; internal GenericSkill DomainSkill => domainSkill; private void Start() { GenericSkill[] components = ((Component)this).GetComponents(); for (int i = 0; i < components.Length; i++) { switch (components[i].skillName) { case "SideRed": redSkill = components[i]; break; case "SideBlue": blueSkill = components[i]; break; case "Domain": domainSkill = components[i]; break; } } } internal int ConsumeNextPunchStep() { if (Time.time - lastPunchStepAt > 2.9f) { nextPunchStep = 0; } int result = nextPunchStep; nextPunchStep = (nextPunchStep + 1) % 3; lastPunchStepAt = Time.time; return result; } internal void Configure(GenericSkill red, GenericSkill blue, GenericSkill domain) { redSkill = red; blueSkill = blue; domainSkill = domain; } private void Update() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (JujutsuInput.IsBlocked || !Util.HasEffectiveAuthority(((Component)this).gameObject)) { RedHeld = false; BlueHeld = false; previousRedHeld = false; previousBlueHeld = false; previousDomainHeld = false; return; } RedHeld = JujutsuInput.GetKey(JujutsuConfig.SideSkill1Key.Value); BlueHeld = JujutsuInput.GetKey(JujutsuConfig.SideSkill2Key.Value); bool key = JujutsuInput.GetKey(JujutsuConfig.DomainKey.Value); if (RedHeld && !previousRedHeld) { GenericSkill obj = redSkill; if (obj != null) { obj.ExecuteIfReady(); } } if (BlueHeld && !previousBlueHeld) { GenericSkill obj2 = blueSkill; if (obj2 != null) { obj2.ExecuteIfReady(); } } if (key && !previousDomainHeld) { GenericSkill obj3 = domainSkill; if (obj3 != null) { obj3.ExecuteIfReady(); } } previousRedHeld = RedHeld; previousBlueHeld = BlueHeld; previousDomainHeld = key; } } internal sealed class InfinityFieldController : MonoBehaviour { internal const float Radius = 16f; private const float InnerFraction = 0.35f; private const float MiddleFraction = 0.7f; private const float TickInterval = 0.25f; private const float SlowDuration = 0.4f; private readonly HashSet victims = new HashSet(); private CharacterBody body; private float tickStopwatch; private void Awake() { body = ((Component)this).GetComponent(); } private void FixedUpdate() { if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive) { tickStopwatch += Time.fixedDeltaTime; if (!(tickStopwatch < 0.25f)) { tickStopwatch = 0f; ApplySlow(); } } } private void ApplySlow() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_00b5: 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) Vector3 corePosition = body.corePosition; Collider[] colliders; int num = GojoDamageUtility.OverlapEnemiesNonAlloc(corePosition, 16f, out colliders); if (num == 0) { return; } TeamIndex ownerTeam = (TeamIndex)((!Object.op_Implicit((Object)(object)body.teamComponent)) ? 1 : ((int)body.teamComponent.teamIndex)); victims.Clear(); for (int i = 0; i < num; i++) { HealthComponent val = GojoDamageUtility.FindEnemyHealth(colliders[i], ownerTeam, victims); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.body)) { CharacterBody val2 = val.body; if (!val2.HasBuff(Buffs.Slow50) && !val2.HasBuff(Buffs.Slow60) && !val2.HasBuff(Buffs.Slow80)) { float num2 = Vector3.Distance(val2.corePosition, corePosition); val2.AddTimedBuff(SelectSlow(num2 / 16f), 0.4f); } } } victims.Clear(); } private static BuffDef SelectSlow(float distanceFraction) { if (distanceFraction <= 0.35f) { return Buffs.Slow80; } if (distanceFraction <= 0.7f) { return Buffs.Slow60; } return Buffs.Slow50; } } internal static class InheritedSkins { internal static void KeepFirstOnly(GameObject bodyPrefab) { ModelSkinController val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponentInChildren(true) : null); if (Object.op_Implicit((Object)(object)val) && val.skins != null && val.skins.Length > 1) { SkinDef val2 = val.skins[0]; Plugin.Log.LogInfo((object)(((Object)bodyPrefab).name + ": dropped " + $"{val.skins.Length - 1} inherited skins, kept " + (Object.op_Implicit((Object)(object)val2) ? ((Object)val2).name : "") + ".")); val.skins = (SkinDef[])(object)new SkinDef[1] { val2 }; } } } internal sealed class JujutsuCloseDash { internal const float StepSpeed = 150f; private const float ArriveWithin = 2f; private const float ApproachGain = 0.5f; private const int StallTicks = 3; private const float StallFraction = 0.25f; private const float Grace = 0.25f; private float speed; private float timeLeft; private float lastDistance; private int stalled; private const int TicksLogged = 40; private string label; private int tick; internal bool Running { get; private set; } internal bool Stopped { get; private set; } internal static void IgnoreFalls(CharacterBody body, bool ignoring) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { if (ignoring) { body.bodyFlags = (BodyFlags)(body.bodyFlags | 1); } else { body.bodyFlags = (BodyFlags)(body.bodyFlags & -2); } } } internal void Begin(Vector3 here, Vector3 destination, float speed, string label = "step") { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) this.speed = Mathf.Max(1f, speed); this.label = label; lastDistance = Vector3.Distance(here, destination); timeLeft = lastDistance / this.speed + 0.25f; stalled = 0; tick = 0; Running = true; Stopped = false; Plugin.Log.LogInfo((object)($"closedash {label}: begin, {lastDistance:0.00}m to go, " + $"from {here} to {destination}.")); } internal bool Advance(CharacterMotor motor, Vector3 here, Vector3 destination, float deltaTime) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (!Running) { return true; } Vector3 val = destination - here; float magnitude = ((Vector3)(ref val)).magnitude; if (tick < 40) { Plugin.Log.LogInfo((object)($"closedash {label} t{tick:00}: at {here}, mark " + $"{destination}, {magnitude:0.000}m, " + $"moved {lastDistance - magnitude:+0.000;-0.000}m, " + $"stalled {stalled}, left {timeLeft:0.000}s")); } tick++; if (magnitude <= 2f) { Running = false; Plugin.Log.LogInfo((object)($"closedash {label}: arrived after {tick} tick(s), " + $"{magnitude:0.000}m from the mark.")); return true; } timeLeft -= deltaTime; if (timeLeft <= 0f) { Running = false; Stopped = true; Plugin.Log.LogInfo((object)($"closedash {label}: out of time after {tick} tick(s), " + $"still {magnitude:0.000}m short.")); return true; } if (lastDistance - magnitude < speed * deltaTime * 0.25f) { stalled++; if (stalled >= 3) { Running = false; Stopped = true; Plugin.Log.LogInfo((object)($"closedash {label}: stopped after {tick} tick(s), " + $"{magnitude:0.000}m short - something is holding him.")); return true; } } else { stalled = 0; } lastDistance = magnitude; if (Object.op_Implicit((Object)(object)motor)) { float num = Mathf.Min(speed, magnitude * 0.5f / Mathf.Max(deltaTime, 0.0001f)); motor.velocity = val / magnitude * num; } return false; } } internal sealed class JujutsuCrosshairAim : MonoBehaviour { private const float MinimumLead = 8f; private const float MaximumReach = 2000f; private const float ReportableCorrection = 15f; private const int ReportLimit = 5; private static int reported; private CharacterBody body; private InputBankTest input; internal static void Apply(GameObject bodyPrefab) { if (Object.op_Implicit((Object)(object)bodyPrefab) && Object.op_Implicit((Object)(object)bodyPrefab.GetComponent()) && !Object.op_Implicit((Object)(object)bodyPrefab.GetComponent())) { bodyPrefab.AddComponent(); } } private void Awake() { body = ((Component)this).GetComponent(); input = ((Component)this).GetComponent(); } private void LateUpdate() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)input) || !body.hasEffectiveAuthority) { return; } Transform val = FindEye(); if (!Object.op_Implicit((Object)(object)val)) { return; } Vector3 forward = val.forward; if (!(((Vector3)(ref forward)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref forward)).Normalize(); Vector3 position = val.position; Vector3 aimOrigin = body.aimOrigin; float num = Mathf.Max(0f, Vector3.Dot(aimOrigin - position, forward)); float num2 = 2000f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(new Ray(position, forward), ref val2, 2000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { num2 = ((RaycastHit)(ref val2)).distance; } num2 = Mathf.Max(num2, num + 8f); Vector3 val3 = position + forward * num2 - aimOrigin; if (!(((Vector3)(ref val3)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val3)).Normalize(); Report(val3, num2, num); input.aimDirection = val3; } } } private Transform FindEye() { CameraRigController val = FindRig(); if (!Object.op_Implicit((Object)(object)val)) { return null; } if (!Object.op_Implicit((Object)(object)val.sceneCam)) { return ((Component)val).transform; } return ((Component)val.sceneCam).transform; } private CameraRigController FindRig() { ReadOnlyCollection readOnlyLocalUsersList = LocalUserManager.readOnlyLocalUsersList; if (readOnlyLocalUsersList != null) { for (int i = 0; i < readOnlyLocalUsersList.Count; i++) { LocalUser val = readOnlyLocalUsersList[i]; if (val != null && Object.op_Implicit((Object)(object)val.cameraRigController) && (Object)(object)val.cachedBody == (Object)(object)body) { return val.cameraRigController; } } } ReadOnlyCollection readOnlyInstancesList = CameraRigController.readOnlyInstancesList; if (readOnlyInstancesList != null) { for (int j = 0; j < readOnlyInstancesList.Count; j++) { if (Object.op_Implicit((Object)(object)readOnlyInstancesList[j]) && (Object)(object)readOnlyInstancesList[j].target == (Object)(object)((Component)this).gameObject) { return readOnlyInstancesList[j]; } } } return null; } private void Report(Vector3 corrected, float distance, float bodyDepth) { //IL_000f: 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_0024: 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) if (reported >= 5) { return; } Vector3 aimDirection = input.aimDirection; if (!(((Vector3)(ref aimDirection)).sqrMagnitude < 0.0001f)) { float num = Vector3.Angle(aimDirection, corrected); if (!(num < 15f)) { reported++; Plugin.Log.LogInfo((object)($"{((Object)body).name}: aim was {num:0.0} degrees off the crosshair " + $"and was corrected — camera to aim point {distance:0.0}m, " + $"camera to body {bodyDepth:0.0}m.")); } } } } internal static class JujutsuDiagnostics { private const float ReportInterval = 20f; private const int RunawayPerSecond = 100; private static readonly Dictionary counts = new Dictionary(); private static readonly Dictionary reported = new Dictionary(); private static readonly HashSet runaway = new HashSet(); private static int teleportsReported; private const int MostTeleportsReported = 24; private static readonly HashSet describedBodies = new HashSet(); internal static void Initialize() { CharacterBody.onBodyStartGlobal += OnBodyStart; } private static void OnBodyStart(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return; } string text = ((Object)body).name ?? string.Empty; if (text.IndexOf("Gojo", StringComparison.Ordinal) >= 0 || text.IndexOf("Sukuna", StringComparison.Ordinal) >= 0 || text.IndexOf("Yuji", StringComparison.Ordinal) >= 0 || text.IndexOf("Todo", StringComparison.Ordinal) >= 0) { if (describedBodies.Add(text)) { ReportSession(body); } ((Component)body).gameObject.AddComponent(); } } internal static void Sent(string kind) { counts.TryGetValue(kind, out var value); counts[kind] = value + 1; } internal static IEnumerator ReportPeriodically() { while (true) { yield return (object)new WaitForSeconds(20f); Report(); } } private static void Report() { if (counts.Count == 0) { return; } StringBuilder stringBuilder = null; foreach (KeyValuePair count in counts) { reported.TryGetValue(count.Key, out var value); int num = count.Value - value; if (num > 0) { reported[count.Key] = count.Value; float num2 = (float)num / 20f; if (num2 >= 100f && runaway.Add(count.Key)) { Plugin.Log.LogError((object)($"Network message '{count.Key}' is going out {num2:F0} " + "times a second, which is not something a player can be doing. This is what a message being relayed back to whoever sent it looks like, and it ends in a crash. Reported once for this message.")); } stringBuilder = stringBuilder ?? new StringBuilder("Network traffic: "); stringBuilder.Append($"{count.Key} {num} ({num2:F1}/s) "); } } if (stringBuilder != null) { Plugin.Log.LogInfo((object)stringBuilder.ToString().TrimEnd()); } } internal static void ReportSession(CharacterBody body) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { string arg = ((!NetworkServer.active) ? "client" : (NetworkClient.active ? "host" : "dedicated server")); int num = ((PlayerCharacterMasterController.instances != null) ? PlayerCharacterMasterController.instances.Count : 0); Plugin.Log.LogInfo((object)($"Session: this machine is the {arg}, {num} player(s). " + body.GetDisplayName() + " spawned as netId " + (Object.op_Implicit((Object)(object)body.networkIdentity) ? ((object)body.networkIdentity.netId/*cast due to .constrained prefix*/).ToString() : "none") + ", " + $"authority here: {Util.HasEffectiveAuthority(((Component)body).gameObject)}, " + $"player controlled: {body.isPlayerControlled}.")); } } [ConCommand(/*Could not decode attribute arguments.*/)] public static void CcJujutsuSelfTest(ConCommandArgs args) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) CharacterBody val = ((ConCommandArgs)(ref args)).senderBody ?? ((LocalUserManager.GetFirstLocalUser() != null) ? LocalUserManager.GetFirstLocalUser().cachedBody : null); if (!Object.op_Implicit((Object)(object)val)) { Debug.Log((object)"jujutsu_selftest: no body to test from. Start a run."); return; } Debug.Log((object)("jujutsu_selftest: teleport, from " + $"{val.footPosition:F1}")); int num = 0; int num2 = 0; float[] array = new float[3] { 4f, 12f, 25f }; foreach (float num3 in array) { for (int j = 0; j < 8; j++) { float num4 = (float)j * MathF.PI * 0.25f; Vector3 val2 = val.footPosition + new Vector3(Mathf.Cos(num4) * num3, 0f, Mathf.Sin(num4) * num3); Vector3 val3 = JujutsuTeleport.SafePoint(val.footPosition, val2, val); if (!(val3 == val2)) { num++; if (val3 == val.footPosition) { num2++; } } } } Debug.Log((object)($" 24 destinations tried: {24 - num} taken as asked, " + $"{num} refused, {num2} of those with nowhere to go. " + "On open ground almost all should be taken; if most are refused standing in a field, the solver is broken again.")); Debug.Log((object)"jujutsu_selftest: network traffic so far"); if (counts.Count == 0) { Debug.Log((object)" nothing sent or received yet."); } foreach (KeyValuePair count in counts) { Debug.Log((object)$" {count.Key}: {count.Value}"); } Debug.Log((object)" A RECEIVED count climbing well past its sent count is a message being relayed back to whoever sent it, which is the shape that crashed 4.142."); } internal static string Read(object target, string field) { if (target == null) { return "n/a"; } try { FieldInfo field2 = target.GetType().GetField(field, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { return Convert.ToString(field2.GetValue(target)); } PropertyInfo property = target.GetType().GetProperty(field, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return (property != null) ? Convert.ToString(property.GetValue(target, null)) : "absent"; } catch (Exception ex) { return "unreadable (" + ex.GetType().Name + ")"; } } internal static void Teleport(string ability, Vector3 wanted, Vector3 given, string why) { //IL_0016: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (teleportsReported < 24) { teleportsReported++; float num = Vector3.Distance(wanted, given); Plugin.Log.LogInfo((object)($"Teleport ({ability}): asked for {wanted:F1}, " + $"got {given:F1} — {why}" + ((num > 0.01f) ? $", which is {num:F1} m from what was asked for." : "."))); } } } internal sealed class JujutsuVisibilityWatch : MonoBehaviour { private const float Interval = 2f; private const int MostReports = 8; private CharacterModel model; private CharacterBody body; private string last; private float next; private int reports; private void Start() { body = ((Component)this).GetComponent(); } private bool Found() { if (Object.op_Implicit((Object)(object)model)) { return true; } ModelLocator component = ((Component)this).GetComponent(); Transform val = (Object.op_Implicit((Object)(object)component) ? component.modelTransform : null); model = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent() : ((Component)this).GetComponentInChildren(true)); return Object.op_Implicit((Object)(object)model); } private void Update() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) if (Time.unscaledTime < next || reports >= 8) { return; } if (!Found()) { next = Time.unscaledTime + 2f; return; } next = Time.unscaledTime + 2f; int num = 0; int num2 = 0; if (model.baseRendererInfos != null) { RendererInfo[] baseRendererInfos = model.baseRendererInfos; foreach (RendererInfo val in baseRendererInfos) { if (Object.op_Implicit((Object)(object)val.renderer)) { if (val.renderer.enabled) { num++; } else { num2++; } } } } int num3 = 0; if (model.baseRendererInfos != null) { RendererInfo[] baseRendererInfos = model.baseRendererInfos; foreach (RendererInfo val2 in baseRendererInfos) { if (Object.op_Implicit((Object)(object)val2.renderer) && !Object.op_Implicit((Object)(object)val2.defaultMaterial)) { num3++; } } } string text = "n/a"; if (Object.op_Implicit((Object)(object)body)) { try { text = $"{body.HasBuff(Buffs.Cloak)}/" + $"{body.HasBuff(Buffs.CloakSpeed)}"; } catch (Exception) { text = "unreadable"; } } string text2 = "visibility=" + JujutsuDiagnostics.Read(model, "visibility") + ", invisibilityCount=" + JujutsuDiagnostics.Read(model, "invisibilityCount") + ", " + $"renderers {num} on / {num2} off, " + $"{num3} with no default material, " + "cloak/cloakSpeed " + text; if (!(text2 == last)) { last = text2; reports++; Plugin.Log.LogInfo((object)("Rendering " + (Object.op_Implicit((Object)(object)body) ? body.GetDisplayName() : ((Object)this).name) + ": " + text2 + ", " + $"authority here {Util.HasEffectiveAuthority(((Component)this).gameObject)}, " + $"server {NetworkServer.active}. Changes only, {8} " + "per body.")); } } } internal static class JujutsuExperienceController { private const float KillExperienceMultiplier = 0.35f; private static bool initialized; internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!initialized) { initialized = true; ExperienceManager.AwardExperience += new hook_AwardExperience(AwardExperience); } } private static void AwardExperience(orig_AwardExperience original, ExperienceManager self, Vector3 origin, CharacterBody recipient, ulong amount) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)recipient) && Object.op_Implicit((Object)(object)((Component)recipient).GetComponent()) && amount != 0) { amount = (ulong)Mathf.Max(1f, Mathf.Floor((float)amount * 0.35f)); } original.Invoke(self, origin, recipient, amount); } } internal static class JujutsuHitSync { private sealed class Handler { internal Action Apply; internal float Reach; } private static readonly Dictionary handlers = new Dictionary(StringComparer.Ordinal); internal static void Initialize() { NetworkingAPI.RegisterMessageType(); } internal static void Register(string kind, float reach, Action apply) { if (!string.IsNullOrEmpty(kind) && apply != null) { handlers[kind] = new Handler { Apply = apply, Reach = reach }; } } internal static void Request(CharacterBody attacker, string kind, Vector3 from, Vector3 to, float size, bool blackFlash) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)attacker) && Object.op_Implicit((Object)(object)attacker.networkIdentity)) { NetMessageExtensions.Send((INetMessage)(object)new JujutsuHitMessage(attacker.networkIdentity.netId, kind, from, to, size, blackFlash), (NetworkDestination)2); Plugin.Log.LogInfo((object)($"hit '{kind}' asked for at {from} (server={NetworkServer.active}, " + $"authority={Util.HasEffectiveAuthority(((Component)attacker).gameObject)}).")); } } internal static void Land(NetworkInstanceId attackerId, string kind, Vector3 from, Vector3 to, float size, bool blackFlash) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (!handlers.TryGetValue(kind, out var value)) { Plugin.Log.LogWarning((object)("A '" + kind + "' hit arrived and nothing is registered to land it; the character's package is probably not installed on this machine.")); return; } GameObject val = Util.FindNetworkObject(attackerId); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); if (Object.op_Implicit((Object)(object)val2)) { float reach = value.Reach; Vector3 val3 = val2.corePosition - from; if (((Vector3)(ref val3)).sqrMagnitude > reach * reach) { Plugin.Log.LogWarning((object)("A '" + kind + "' hit was asked for further from the caster than the skill reaches, and has been dropped.")); return; } Plugin.Log.LogInfo((object)("hit '" + kind + "' landed on the host for " + ((Object)val2).name + ".")); value.Apply(val2, from, to, size, blackFlash); } } } public sealed class JujutsuHitMessage : INetMessage, ISerializableObject { private NetworkInstanceId attacker; private string kind; private Vector3 from; private Vector3 to; private float size; private bool blackFlash; public JujutsuHitMessage() { } public JujutsuHitMessage(NetworkInstanceId attacker, string kind, Vector3 from, Vector3 to, float size, bool blackFlash) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_001c: 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) this.attacker = attacker; this.kind = kind; this.from = from; this.to = to; this.size = size; this.blackFlash = blackFlash; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) writer.Write(attacker); writer.Write(kind); writer.Write(from); writer.Write(to); writer.Write(size); writer.Write(blackFlash); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) attacker = reader.ReadNetworkId(); kind = reader.ReadString(); from = reader.ReadVector3(); to = reader.ReadVector3(); size = reader.ReadSingle(); blackFlash = reader.ReadBoolean(); } public void OnReceived() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { JujutsuHitSync.Land(attacker, kind, from, to, size, blackFlash); } } } internal static class JujutsuHudAnchor { private static TMP_FontAsset cachedFont; internal static Transform Find(HUD hud, ref bool reported) { Transform val = (Object.op_Implicit((Object)(object)hud.mainContainer) ? hud.mainContainer.transform : ((Component)hud).transform); string[] array = new string[3] { "MainUIArea/SpringCanvas/BottomRightCluster", "SpringCanvas/BottomRightCluster", "MainUIArea/SpringCanvas/BottomLeftCluster" }; for (int i = 0; i < array.Length; i++) { Transform val2 = val.Find(array[i]); if (Object.op_Implicit((Object)(object)val2)) { if (!reported) { reported = true; Plugin.Log.LogInfo((object)("Jujutsu HUD elements anchored to " + array[i] + ".")); } return val2; } } if (!reported) { reported = true; Plugin.Log.LogWarning((object)("None of the expected HUD clusters were found, so the mod's HUD elements hang off the HUD root and may sit oddly. Looked for: " + string.Join(", ", array))); } return val; } internal static Image Fill(RectTransform parent, string name, Color colour, float inset) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = new Vector2(0f - inset, 0f - inset); val2.offsetMax = new Vector2(inset, inset); Image obj = val.AddComponent(); ((Graphic)obj).color = colour; ((Graphic)obj).raycastTarget = false; return obj; } internal static Image Bar(RectTransform parent, string name, Vector2 anchor, float width, float height, float inset) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = anchor; val2.anchorMax = anchor; val2.pivot = new Vector2(0f, anchor.y); val2.sizeDelta = new Vector2(width, height); val2.anchoredPosition = new Vector2(0f - inset, 0f); Image obj = val.AddComponent(); ((Graphic)obj).color = Color.white; ((Graphic)obj).raycastTarget = false; return obj; } internal static GameObject Box(RectTransform parent, string name, Color colour, Vector2 anchor, Vector2 size, Vector2 offset) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = anchor; val2.anchorMax = anchor; val2.pivot = anchor; val2.sizeDelta = size; val2.anchoredPosition = offset; Image obj = val.AddComponent(); ((Graphic)obj).color = colour; ((Graphic)obj).raycastTarget = false; return val; } internal static TextMeshProUGUI Text(RectTransform parent, string name, float size, Color colour) { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; TextMeshProUGUI val3 = val.AddComponent(); ((TMP_Text)val3).fontSize = size; ((Graphic)val3).color = colour; ((TMP_Text)val3).fontStyle = (FontStyles)1; ((Graphic)val3).raycastTarget = false; ((TMP_Text)val3).enableWordWrapping = false; TMP_FontAsset val4 = Font(); if (Object.op_Implicit((Object)(object)val4)) { ((TMP_Text)val3).font = val4; } return val3; } internal static TMP_FontAsset Font() { if (Object.op_Implicit((Object)(object)cachedFont)) { return cachedFont; } TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if (Object.op_Implicit((Object)(object)array[i])) { cachedFont = array[i]; break; } } if (!Object.op_Implicit((Object)(object)cachedFont)) { Plugin.Log.LogWarning((object)"No TMP font was loaded when a HUD element was built, so its text may not draw."); } return cachedFont; } } internal static class JujutsuInput { private const float UiRescanInterval = 1f; private static ChatBox cachedChatBox; private static ConsoleWindow cachedConsoleWindow; private static float nextUiScanTime; private static int evaluatedFrame = -1; private static bool blocked; private static bool reportedBlocked; internal static bool IsBlocked { get { if (evaluatedFrame == Time.frameCount) { return blocked; } evaluatedFrame = Time.frameCount; blocked = Evaluate(); return blocked; } } internal static bool GetKey(KeyCode key) { //IL_0000: 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) if ((int)key != 0 && !IsBlocked) { return Input.GetKey(key); } return false; } internal static bool GetKey(KeyboardShortcut key) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) if ((int)((KeyboardShortcut)(ref key)).MainKey == 0) { return false; } if (Input.GetKey(((KeyboardShortcut)(ref key)).MainKey) && IsBlocked && !reportedBlocked) { reportedBlocked = true; Plugin.Log.LogInfo((object)($"The bind {key} was pressed while gameplay binds are " + "being ignored, so it did nothing. Something has the keyboard: a chat box, the console, or a text field left selected. Reported once.")); } if (!IsBlocked) { return Held(key); } return false; } private static bool Held(KeyboardShortcut key) { //IL_0002: 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) if (!Input.GetKey(((KeyboardShortcut)(ref key)).MainKey)) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref key)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return true; } internal static string Describe(KeyboardShortcut key) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Describe(((KeyboardShortcut)(ref key)).MainKey); } internal unsafe static string Describe(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown if ((int)key != 0) { switch (key - 323) { case 0: return "M1"; case 1: return "M2"; case 2: return "M3"; case 3: return "M4"; case 4: return "M5"; case 5: return "M6"; case 6: return "M7"; default: { string text = ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(); if (text.Length <= 4) { return text; } return text.Substring(0, 4); } } } return "--"; } private static bool Evaluate() { if (!Application.isFocused || PauseManager.isPaused) { return true; } RefreshUiCache(); if (Object.op_Implicit((Object)(object)cachedChatBox) && Object.op_Implicit((Object)(object)cachedChatBox.inputField) && cachedChatBox.inputField.isFocused) { return true; } if (Object.op_Implicit((Object)(object)cachedConsoleWindow) && Object.op_Implicit((Object)(object)cachedConsoleWindow.inputField) && cachedConsoleWindow.inputField.isFocused) { return true; } return IsTextFieldSelected(); } private static void RefreshUiCache() { if ((!Object.op_Implicit((Object)(object)cachedChatBox) || !Object.op_Implicit((Object)(object)cachedConsoleWindow)) && !(Time.unscaledTime < nextUiScanTime)) { nextUiScanTime = Time.unscaledTime + 1f; if (!Object.op_Implicit((Object)(object)cachedChatBox)) { cachedChatBox = Object.FindObjectOfType(); } if (!Object.op_Implicit((Object)(object)cachedConsoleWindow)) { cachedConsoleWindow = Object.FindObjectOfType(); } } } private static bool IsTextFieldSelected() { List instancesList = MPEventSystem.instancesList; if (instancesList == null) { return false; } for (int i = 0; i < instancesList.Count; i++) { MPEventSystem val = instancesList[i]; GameObject val2 = (Object.op_Implicit((Object)(object)val) ? ((EventSystem)val).currentSelectedGameObject : null); if (Object.op_Implicit((Object)(object)val2)) { TMP_InputField component = val2.GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.isFocused) { return true; } InputField component2 = val2.GetComponent(); if (Object.op_Implicit((Object)(object)component2) && component2.isFocused) { return true; } } } return false; } } public static class JujutsuMainMenuDisplay { private const string MarkerName = "JujutsuMainMenuDisplays"; private const float ReferenceDepth = 12f; private const string WarmupName = "JujutsuMainMenuWarmup"; private static readonly Vector3 OffStage = new Vector3(0f, -900f, 0f); private static readonly List warming = new List(); internal static void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown MainMenuController.Start += new hook_Start(Spawn); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(BuildDuringLoad)); } private static void BuildDuringLoad() { if (!JujutsuConfig.MainMenuCharacters.Value) { return; } try { BuildOutOfSight(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Main menu characters could not be built during load: " + ex)); } } private static void Spawn(orig_Start original, MainMenuController self) { original.Invoke(self); if (JujutsuConfig.MainMenuCharacters.Value) { ((MonoBehaviour)self).StartCoroutine(PlaceWhenCameraExists()); } } private static IEnumerator PlaceWhenCameraExists() { BuildOutOfSight(); for (int attempt = 0; attempt < 120; attempt++) { if (Object.op_Implicit((Object)(object)GameObject.Find("JujutsuMainMenuDisplays"))) { yield break; } Camera camera = FindMenuCamera(); if (Object.op_Implicit((Object)(object)camera)) { Plugin.Log.LogInfo((object)("Main menu characters: measuring against camera " + $"'{((Object)camera).name}' at {((Component)camera).transform.position}.")); yield return WaitUntilDressed(); try { SpawnPair(camera); yield break; } catch (Exception ex) { Plugin.Log.LogError((object)("Main menu characters could not be placed: " + ex)); yield break; } } yield return null; } Plugin.Log.LogInfo((object)"Main menu characters: no camera ever appeared to place them against."); } private static void BuildOutOfSight() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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) warming.RemoveAll((GameObject instance) => !Object.op_Implicit((Object)(object)instance)); if (warming.Count > 0 || Object.op_Implicit((Object)(object)GameObject.Find("JujutsuMainMenuWarmup"))) { return; } GameObject val = new GameObject("JujutsuMainMenuWarmup"); val.transform.position = OffStage; Object.DontDestroyOnLoad((Object)(object)val); List list = JujutsuCharacters.Roster(); for (int num = 0; num < list.Count; num++) { GameObject val2 = (Object.op_Implicit((Object)(object)list[num].Survivor) ? list[num].Survivor.displayPrefab : null); if (!Object.op_Implicit((Object)(object)val2)) { warming.Add(null); continue; } GameObject val3 = Object.Instantiate(val2, OffStage, Quaternion.identity, val.transform); ((Object)val3).name = ((Object)val2).name + "MainMenu"; WearMenuSkin(val3, list[num].MenuSkin, list[num].Key); warming.Add(val3); } Plugin.Log.LogInfo((object)($"Main menu characters: {warming.Count} built off-stage " + "during load; they are moved into shot once every renderer has a texture on it.")); } private static IEnumerator WaitUntilDressed() { float waited = 0f; Renderer blocking = null; while (waited < 1.5f) { blocking = Undressed(); if (!Object.op_Implicit((Object)(object)blocking)) { Plugin.Log.LogInfo((object)("Main menu characters: dressed after " + $"{waited:0.00}s off-stage.")); yield break; } waited += Time.unscaledDeltaTime; yield return null; } Plugin.Log.LogWarning((object)($"Main menu characters: still undressed after {1.5f:0}s; " + "showing them anyway. Waiting on '" + (Object.op_Implicit((Object)(object)blocking) ? ((Object)blocking).name : "nothing") + "' with material '" + ((Object.op_Implicit((Object)(object)blocking) && Object.op_Implicit((Object)(object)blocking.sharedMaterial)) ? ((Object)blocking.sharedMaterial).name : "none") + "'.")); } private static Renderer Undressed() { for (int i = 0; i < warming.Count; i++) { GameObject val = warming[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { return null; } foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && ((Renderer)val2).enabled && ((Component)val2).gameObject.activeInHierarchy && !Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { return (Renderer)(object)val2; } } } return null; } private static void SpawnPair(Camera camera) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GameObject val = new GameObject("JujutsuMainMenuDisplays"); float value = JujutsuConfig.MainMenuSpacing.Value; List list = JujutsuCharacters.Roster(); List list2 = new List(list.Count); for (int i = 0; i < list.Count; i++) { float num = ((float)i - (float)(list.Count - 1) * 0.5f) * (2f / 3f); GameObject val2 = Place(val.transform, camera, list[i].Survivor, 0.5f + value * num, list[i].Key, list[i].MenuSkin, (i < warming.Count) ? warming[i] : null); if (Object.op_Implicit((Object)(object)val2)) { list2.Add(val2); } } ClearTitle(camera, list2); } [ConCommand(commandName = "jujutsu_menu", helpText = "jujutsu_menu [depth spread height [scale]] - moves the title screen pair and saves where they end up.")] public static void CcJujutsuMenu(ConCommandArgs args) { if (((ConCommandArgs)(ref args)).Count >= 3 && float.TryParse(((ConCommandArgs)(ref args))[0], out var result) && float.TryParse(((ConCommandArgs)(ref args))[1], out var result2) && float.TryParse(((ConCommandArgs)(ref args))[2], out var result3)) { JujutsuConfig.MainMenuDistance.Value = result; JujutsuConfig.MainMenuSpacing.Value = result2; JujutsuConfig.MainMenuHeight.Value = result3; } if (((ConCommandArgs)(ref args)).Count >= 4 && float.TryParse(((ConCommandArgs)(ref args))[3], out var result4)) { JujutsuConfig.MainMenuScale.Value = result4; } Debug.Log((object)($"jujutsu_menu depth={JujutsuConfig.MainMenuDistance.Value} " + $"spread={JujutsuConfig.MainMenuSpacing.Value} " + $"height={JujutsuConfig.MainMenuHeight.Value} " + $"(scale {JujutsuConfig.MainMenuScale.Value})")); GameObject val = GameObject.Find("JujutsuMainMenuDisplays"); if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } Camera val2 = FindMenuCamera(); if (Object.op_Implicit((Object)(object)val2) && JujutsuConfig.MainMenuCharacters.Value) { SpawnPair(val2); } } private static GameObject Place(Transform parent, Camera camera, SurvivorDef survivor, float screenX, string label, string menuSkin, GameObject warmed) { //IL_0056: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_020c: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)survivor) ? survivor.displayPrefab : null); if (!Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)warmed)) { Plugin.Log.LogInfo((object)("Main menu characters: " + label + " has no display prefab.")); return null; } Vector3 val2 = camera.ViewportToWorldPoint(new Vector3(screenX, JujutsuConfig.MainMenuHeight.Value, JujutsuConfig.MainMenuDistance.Value)); RaycastHit val3 = default(RaycastHit); bool flag = Physics.Raycast(val2 + Vector3.up * 60f, Vector3.down, ref val3, 200f, -1, (QueryTriggerInteraction)1); if (flag) { val2 = ((RaycastHit)(ref val3)).point; } Vector3 val4 = ((Component)camera).transform.position - val2; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f) { val4 = -((Component)camera).transform.forward; val4.y = 0f; } val4 = ((((Vector3)(ref val4)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val4)).normalized : Vector3.forward); GameObject val5 = warmed; if (!Object.op_Implicit((Object)(object)val5)) { val5 = Object.Instantiate(val); ((Object)val5).name = ((Object)val).name + "MainMenu"; WearMenuSkin(val5, menuSkin, label); } val5.transform.SetPositionAndRotation(val2, Quaternion.LookRotation(val4, Vector3.up)); val5.transform.SetParent(parent, true); Transform transform = val5.transform; transform.localScale *= JujutsuConfig.MainMenuScale.Value * (JujutsuConfig.MainMenuDistance.Value / 12f); Plugin.Log.LogInfo((object)("Main menu characters: " + label + " at screen " + $"({screenX:0.00}, {JujutsuConfig.MainMenuHeight.Value:0.00}) " + $"{JujutsuConfig.MainMenuDistance.Value:0.0}m deep, world {val2}, " + $"turned {Vector3.SignedAngle(-((Component)camera).transform.forward, val4, Vector3.up):0.#}° " + "off the lens axis, " + (flag ? "feet on the ground" : "no ground under them - standing at the screen height") + ".")); return val5; } private static void ClearTitle(Camera camera, List standing) { //IL_012d: 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) float value = JujutsuConfig.MainMenuTitleClearance.Value; if (value >= 1f || standing.Count == 0) { return; } float num = float.NegativeInfinity; float num2 = 0f; string text = "none"; foreach (GameObject item in standing) { if (TryMeasureHead(camera, item, out var head, out var feet, out var measured) && head > num) { num = head; num2 = feet; text = ((Object)item).name + "/" + measured; } } if (float.IsNegativeInfinity(num)) { Plugin.Log.LogInfo((object)"Main menu characters: nothing measurable to clear the title against; left at the configured scale."); return; } if (num <= value) { Plugin.Log.LogInfo((object)("Main menu characters: tallest head (" + text + ") at " + $"{num:0.000} up the screen, under the {value:0.00} " + "the title needs. Left alone.")); return; } float num3 = num - num2; if (num3 <= 0.0001f) { return; } float num4 = Mathf.Clamp((value - num2) / num3, 0.75f, 1f); foreach (GameObject item2 in standing) { Transform transform = item2.transform; transform.localScale *= num4; } Plugin.Log.LogInfo((object)("Main menu characters: tallest head (" + text + ") reached " + $"{num:0.000} up the screen against a {value:0.00} " + $"ceiling, feet at {num2:0.000}. Scaled the group by " + $"{num4:0.000} to put it under the title.")); } private static bool TryMeasureHead(Camera camera, GameObject instance, out float head, out float feet, out string measured) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) head = 0f; feet = 0f; measured = "none"; if (!Object.op_Implicit((Object)(object)instance)) { return false; } Vector3 position = instance.transform.position; List list = new List(); List list2 = new List(); Renderer[] componentsInChildren = instance.GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && val.enabled && ((Component)val).gameObject.activeInHierarchy && (val is SkinnedMeshRenderer || val is MeshRenderer)) { Bounds bounds = val.bounds; list.Add(((Bounds)(ref bounds)).max.y - position.y); list2.Add(((Object)val).name); } } if (list.Count == 0) { return false; } List list3 = new List(list); list3.Sort(); float num = list3[list3.Count / 2]; float num2 = ((num > 0.001f) ? (num * 2.5f) : float.MaxValue); float num3 = float.NegativeInfinity; for (int j = 0; j < list.Count; j++) { if (!(list[j] > num2) && !(list[j] <= num3)) { num3 = list[j]; measured = list2[j]; } } if (float.IsNegativeInfinity(num3)) { return false; } head = camera.WorldToViewportPoint(new Vector3(position.x, position.y + num3, position.z)).y; feet = camera.WorldToViewportPoint(position).y; return true; } private static void WearMenuSkin(GameObject instance, string menuSkin, string label) { if (string.IsNullOrEmpty(menuSkin) || !Object.op_Implicit((Object)(object)instance)) { return; } ModelSkinController componentInChildren = instance.GetComponentInChildren(true); if (!Object.op_Implicit((Object)(object)componentInChildren) || componentInChildren.skins == null) { return; } for (int i = 0; i < componentInChildren.skins.Length; i++) { SkinDef val = componentInChildren.skins[i]; if (Object.op_Implicit((Object)(object)val) && ((Object)val).name.EndsWith(menuSkin, StringComparison.OrdinalIgnoreCase)) { componentInChildren.ApplySkin(i); Plugin.Log.LogInfo((object)("Main menu characters: " + label + " wears " + $"{((Object)val).name} (skin {i}).")); return; } } Plugin.Log.LogWarning((object)("Main menu characters: " + label + " asked for a skin ending in '" + menuSkin + "' and has none; standing in his first.")); } private static Camera FindMenuCamera() { if (Object.op_Implicit((Object)(object)Camera.main)) { return Camera.main; } Camera[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { if (Object.op_Implicit((Object)(object)array[i]) && ((Behaviour)array[i]).isActiveAndEnabled) { return array[i]; } } return null; } } internal static class JujutsuSkillNetworkFix { private static bool initialized; internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!initialized) { initialized = true; CharacterBody.OnSkillActivated += new hook_OnSkillActivated(OnSkillActivated); } } internal static void RegisterExtraSkills(GameObject bodyPrefab) { SkillLocator val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponent() : null); if (Object.op_Implicit((Object)(object)val)) { val.allSkills = bodyPrefab.GetComponents(); } } private static void OnSkillActivated(orig_OnSkillActivated original, CharacterBody self, GenericSkill skill) { if (Object.op_Implicit((Object)(object)skill)) { original.Invoke(self, skill); } } } internal struct JujutsuStripSlot { internal Sprite Icon; internal string Bind; internal string ShortName; internal Color Accent; internal bool Available; internal string OverlayText; internal float ChargeFraction; internal string StockText; internal float GaugeFraction; internal Color GaugeColour; } internal interface IJujutsuSkillStrip { int StripSlotCount { get; } JujutsuStripSlot GetStripSlot(int index); } internal sealed class JujutsuSkillStrip : MonoBehaviour { private sealed class SlotView { internal GameObject Root; internal Image Frame; internal Image Icon; internal Image Dim; internal Image Charge; internal Image GaugeBack; internal Image Gauge; internal TextMeshProUGUI Overlay; internal TextMeshProUGUI Bind; internal TextMeshProUGUI Name; internal TextMeshProUGUI Stock; internal GameObject StockBox; } private const int Capacity = 4; private const float Size = 58f; private const float Gap = 7f; private const float LiftAboveSkills = 150f; private static bool hooked; private static bool reportedAnchor; private HUD hud; private RectTransform root; private SlotView[] views; internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!hooked) { hooked = true; HUD.Awake += new hook_Awake(Attach); } } private static void Attach(orig_Awake original, HUD self) { original.Invoke(self); if (!Object.op_Implicit((Object)(object)self)) { return; } try { Build(self); } catch (Exception ex) { Plugin.Log.LogError((object)("Extra skill panel could not be built: " + ex)); } } private static void Build(HUD hud) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0055: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) Transform val = JujutsuHudAnchor.Find(hud, ref reportedAnchor); GameObject val2 = new GameObject("JujutsuSkillStrip", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent(val, false); val3.anchorMin = new Vector2(1f, 0f); val3.anchorMax = new Vector2(1f, 0f); val3.pivot = new Vector2(1f, 0f); val3.sizeDelta = new Vector2(253f, 58f); val3.anchoredPosition = new Vector2(0f, 150f); CanvasGroup component = val2.GetComponent(); component.blocksRaycasts = false; component.interactable = false; JujutsuSkillStrip jujutsuSkillStrip = val2.AddComponent(); jujutsuSkillStrip.hud = hud; jujutsuSkillStrip.root = val3; jujutsuSkillStrip.views = new SlotView[4]; for (int i = 0; i < 4; i++) { jujutsuSkillStrip.views[i] = jujutsuSkillStrip.BuildSlot(val3, i); } Plugin.Log.LogInfo((object)($"Extra skill panel built as a HUD element with {4} " + "slots; the three IMGUI copies are gone.")); } private SlotView BuildSlot(RectTransform parent, int index) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004f: 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_0079: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: 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_0297: Expected O, but got Unknown //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: 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_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Expected O, but got Unknown SlotView slotView = new SlotView(); GameObject val = new GameObject("Slot" + index, new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)parent, false); val2.anchorMin = new Vector2(1f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(1f, 0f); val2.sizeDelta = new Vector2(58f, 58f); slotView.Root = val; slotView.Frame = JujutsuHudAnchor.Fill(val2, "Frame", Color.white, 3f); JujutsuHudAnchor.Fill(val2, "Background", new Color(0.02f, 0.01f, 0.03f, 0.95f), 0f); slotView.Icon = JujutsuHudAnchor.Fill(val2, "Icon", Color.white, -4f); slotView.Icon.preserveAspect = true; slotView.Dim = JujutsuHudAnchor.Fill(val2, "Dim", new Color(0f, 0f, 0f, 0.6f), -4f); slotView.Charge = JujutsuHudAnchor.Bar(val2, "Charge", new Vector2(0f, 1f), 52f, 3f, -4f); slotView.Overlay = JujutsuHudAnchor.Text(val2, "Overlay", 22f, Color.white); ((TMP_Text)slotView.Overlay).alignment = (TextAlignmentOptions)514; slotView.StockBox = JujutsuHudAnchor.Box(val2, "StockBox", new Color(0f, 0f, 0f, 0.82f), new Vector2(1f, 1f), new Vector2(40f, 16f), new Vector2(-2f, -2f)); slotView.Stock = JujutsuHudAnchor.Text((RectTransform)slotView.StockBox.transform, "Stock", 11f, Color.white); ((TMP_Text)slotView.Stock).alignment = (TextAlignmentOptions)514; GameObject val3 = JujutsuHudAnchor.Box(val2, "BindBox", new Color(0f, 0f, 0f, 0.9f), new Vector2(0f, 0f), new Vector2(31f, 19f), new Vector2(2f, 2f)); slotView.Bind = JujutsuHudAnchor.Text((RectTransform)val3.transform, "Bind", 14f, Color.white); ((TMP_Text)slotView.Bind).alignment = (TextAlignmentOptions)514; slotView.Name = JujutsuHudAnchor.Text(val2, "Name", 11f, new Color(0.9f, 0.94f, 1f, 1f)); ((TMP_Text)slotView.Name).alignment = (TextAlignmentOptions)514; ((TMP_Text)slotView.Name).enableAutoSizing = true; ((TMP_Text)slotView.Name).fontSizeMin = 7f; ((TMP_Text)slotView.Name).fontSizeMax = 11f; RectTransform rectTransform = ((TMP_Text)slotView.Name).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0f); rectTransform.anchorMax = new Vector2(1f, 0f); rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.sizeDelta = new Vector2(7f, 14f); rectTransform.anchoredPosition = new Vector2(0f, -4f); slotView.GaugeBack = JujutsuHudAnchor.Bar(val2, "GaugeBack", new Vector2(0f, 0f), 58f, 4f, 0f); ((Graphic)slotView.GaugeBack).color = new Color(0.05f, 0.06f, 0.09f, 0.85f); ((Graphic)slotView.GaugeBack).rectTransform.anchoredPosition = new Vector2(0f, -20f); slotView.Gauge = JujutsuHudAnchor.Bar((RectTransform)((Component)slotView.GaugeBack).transform, "GaugeFill", new Vector2(0f, 0f), 58f, 4f, 0f); return slotView; } private void Update() { //IL_007d: 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_00f0: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)hud) ? hud.targetBodyObject : null); IJujutsuSkillStrip jujutsuSkillStrip = (Object.op_Implicit((Object)(object)val) ? val.GetComponent() : null); int num = ((jujutsuSkillStrip != null) ? Mathf.Min(jujutsuSkillStrip.StripSlotCount, views.Length) : 0); float num2 = ((num > 0) ? (58f * (float)num + 7f * (float)(num - 1)) : 0f); root.sizeDelta = new Vector2(Mathf.Max(num2, 1f), 58f); for (int i = 0; i < views.Length; i++) { bool flag = i < num; if (views[i].Root.activeSelf != flag) { views[i].Root.SetActive(flag); } if (flag) { ((RectTransform)views[i].Root.transform).anchoredPosition = new Vector2(-65f * (float)(num - 1 - i), 0f); Apply(views[i], jujutsuSkillStrip.GetStripSlot(i)); } } } private static void Apply(SlotView view, JujutsuStripSlot slot) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_01c5: Unknown result type (might be due to invalid IL or missing references) ((Graphic)view.Frame).color = new Color(slot.Accent.r, slot.Accent.g, slot.Accent.b, 0.9f); view.Icon.sprite = slot.Icon; ((Behaviour)view.Icon).enabled = Object.op_Implicit((Object)(object)slot.Icon); ((Graphic)view.Icon).color = (Color)(slot.Available ? Color.white : new Color(0.34f, 0.32f, 0.35f, 1f)); bool flag = !string.IsNullOrEmpty(slot.OverlayText); ((Behaviour)view.Dim).enabled = flag; ((Behaviour)view.Overlay).enabled = flag; if (flag) { ((TMP_Text)view.Overlay).text = slot.OverlayText; } ((Behaviour)view.Charge).enabled = slot.ChargeFraction >= 0f; if (((Behaviour)view.Charge).enabled) { ((Graphic)view.Charge).rectTransform.sizeDelta = new Vector2(52f * Mathf.Clamp01(slot.ChargeFraction), 3f); } bool flag2 = !string.IsNullOrEmpty(slot.StockText); if (view.StockBox.activeSelf != flag2) { view.StockBox.SetActive(flag2); } if (flag2) { ((TMP_Text)view.Stock).text = slot.StockText; } bool flag3 = slot.GaugeFraction >= 0f; if (((Component)view.GaugeBack).gameObject.activeSelf != flag3) { ((Component)view.GaugeBack).gameObject.SetActive(flag3); } if (flag3) { ((Graphic)view.Gauge).color = slot.GaugeColour; ((Graphic)view.Gauge).rectTransform.sizeDelta = new Vector2(58f * Mathf.Clamp01(slot.GaugeFraction), 4f); } ((TMP_Text)view.Bind).text = slot.Bind ?? string.Empty; ((TMP_Text)view.Name).text = slot.ShortName ?? string.Empty; } } internal static class JujutsuTeleport { private const float FootingDepth = 120f; internal static Vector3 SafePoint(Vector3 anchor, Vector3 desired, CharacterBody body) { //IL_0023: 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_0039: 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_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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_006c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) float num = ((Object.op_Implicit((Object)(object)body) && body.radius > 0.1f) ? body.radius : 0.5f); Vector3 val = Vector3.up * Mathf.Max(num, 0.9f); Vector3 fallback = anchor + val; Vector3 point = desired + val; if (Standable(point, num)) { return desired; } Vector3 val2 = Free(point, num, fallback) - val; JujutsuDiagnostics.Teleport("step", desired, val2, (val2 == anchor) ? "nowhere near it was free, so it stayed put" : "the destination was refused and moved"); return val2; } internal static Vector3 UnblockedPoint(Vector3 desired, CharacterBody body, Vector3 fallback) { //IL_0023: 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_0039: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) float num = ((Object.op_Implicit((Object)(object)body) && body.radius > 0.1f) ? body.radius : 0.5f); Vector3 val = Vector3.up * Mathf.Max(num, 0.9f); Vector3 val2 = Free(desired + val, num, fallback + val) - val; if (val2 != desired) { JujutsuDiagnostics.Teleport("swap", desired, val2, (val2 == fallback) ? "nowhere near it was free, so it did not move at all" : "the destination was refused and moved"); } return val2; } private static Vector3 Free(Vector3 point, float radius, Vector3 fallback) { //IL_0000: 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_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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) if (Standable(point, radius)) { return point; } for (float num = 0.2f; num <= 1.001f; num += 0.2f) { Vector3 val = Vector3.Lerp(point, fallback, num); if (Standable(val, radius)) { return val; } } for (float num2 = 0.5f; num2 <= 1.5f; num2 += 0.5f) { Vector3 val2 = point + Vector3.up * num2; if (Standable(val2, radius)) { return val2; } } Vector3 val3 = Vector3.ProjectOnPlane(fallback - point, Vector3.up); float num3 = ((((Vector3)(ref val3)).sqrMagnitude > 0.0001f) ? Mathf.Atan2(val3.z, val3.x) : 0f); for (float num4 = radius; num4 <= radius * 3f; num4 += radius) { for (int i = 0; i < 8; i++) { float num5 = num3 + (float)((i + 1) / 2) * MathF.PI * 0.25f * ((i % 2 == 0) ? 1f : (-1f)); Vector3 val4 = point + new Vector3(Mathf.Cos(num5) * num4, 0f, Mathf.Sin(num5) * num4); if (Standable(val4, radius)) { return val4; } } } return fallback; } private static bool Standable(Vector3 point, float radius) { //IL_0000: 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) if (!Blocked(point, radius)) { return Grounded(point); } return false; } private static bool Grounded(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return Physics.Raycast(point, Vector3.down, 120f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } private static bool Blocked(Vector3 point, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return Physics.CheckSphere(point, radius * 0.9f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } } [DisallowMultipleComponent] internal sealed class NoItemDisplaysController : MonoBehaviour { private static bool hooked; private CharacterModel characterModel; private ItemDisplayRuleSet emptyRuleSet; private static readonly HashSet reportedOverlays = new HashSet(); internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (!hooked) { hooked = true; CharacterModel.HighlightEquipentDisplay += new hook_HighlightEquipentDisplay(HighlightEquipentDisplay); CharacterModel.UpdateOverlays += new hook_UpdateOverlays(UpdateOverlays); } } private static void UpdateOverlays(orig_UpdateOverlays original, CharacterModel self) { original.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)((Component)self).GetComponent()) || self.activeOverlayCount <= 0) { return; } for (int i = 0; i < self.activeOverlayCount; i++) { Material val = self.currentOverlays[i]; string text = (Object.op_Implicit((Object)(object)val) ? ((Object)val).name : ""); if (reportedOverlays.Add(text)) { Plugin.Log.LogInfo((object)("Suppressed overlay material '" + text + "' on " + ((Object)self).name + ". Reported once per material, so this list is what these bodies would otherwise draw.")); } } self.activeOverlayCount = 0; } private static void HighlightEquipentDisplay(orig_HighlightEquipentDisplay original, CharacterModel self, EquipmentIndex equipmentIndex) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)((Component)self).GetComponent())) { original.Invoke(self, equipmentIndex); } } internal static void Apply(GameObject prefab) { if (!Object.op_Implicit((Object)(object)prefab)) { return; } CharacterModel componentInChildren = prefab.GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { NoItemDisplaysController noItemDisplaysController = ((Component)componentInChildren).GetComponent(); if (!Object.op_Implicit((Object)(object)noItemDisplaysController)) { noItemDisplaysController = ((Component)componentInChildren).gameObject.AddComponent(); } noItemDisplaysController.Configure(componentInChildren); } } private void Awake() { if (!Object.op_Implicit((Object)(object)characterModel)) { Configure(((Component)this).GetComponent()); } } private void Start() { SuppressDisplays(); } private void LateUpdate() { SuppressDisplays(); } private void Configure(CharacterModel model) { if (Object.op_Implicit((Object)(object)model)) { characterModel = model; if (!Object.op_Implicit((Object)(object)emptyRuleSet)) { ItemDisplayRuleSet itemDisplayRuleSet = characterModel.itemDisplayRuleSet; emptyRuleSet = ScriptableObject.CreateInstance(); ((Object)emptyRuleSet).name = "idrsNoJujutsuSurvivorItemDisplays"; ((Object)emptyRuleSet).hideFlags = (HideFlags)52; emptyRuleSet.keyAssetRuleGroups = Array.Empty(); emptyRuleSet.runtimeItemRuleGroups = CreateEmptyGroups((itemDisplayRuleSet?.runtimeItemRuleGroups?.Length).GetValueOrDefault()); emptyRuleSet.runtimeEquipmentRuleGroups = CreateEmptyGroups((itemDisplayRuleSet?.runtimeEquipmentRuleGroups?.Length).GetValueOrDefault()); } characterModel.itemDisplayRuleSet = emptyRuleSet; } } private void SuppressDisplays() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)characterModel)) { EnsureRuntimeArraySizes(); if ((Object)(object)characterModel.itemDisplayRuleSet != (Object)(object)emptyRuleSet) { characterModel.itemDisplayRuleSet = emptyRuleSet; } if (characterModel.enabledItemDisplays != null && characterModel.enabledItemDisplays.Count > 0) { characterModel.DisableAllItemDisplays(); } if ((int)characterModel.currentEquipmentDisplayIndex != -1) { characterModel.SetEquipmentDisplay((EquipmentIndex)(-1)); } } } private void EnsureRuntimeArraySizes() { if (Object.op_Implicit((Object)(object)emptyRuleSet)) { int itemCount = ItemCatalog.itemCount; if (itemCount > 0 && (emptyRuleSet.runtimeItemRuleGroups == null || emptyRuleSet.runtimeItemRuleGroups.Length != itemCount)) { emptyRuleSet.runtimeItemRuleGroups = CreateEmptyGroups(itemCount); } int equipmentCount = EquipmentCatalog.equipmentCount; if (equipmentCount > 0 && (emptyRuleSet.runtimeEquipmentRuleGroups == null || emptyRuleSet.runtimeEquipmentRuleGroups.Length != equipmentCount)) { emptyRuleSet.runtimeEquipmentRuleGroups = CreateEmptyGroups(equipmentCount); } } } private static DisplayRuleGroup[] CreateEmptyGroups(int count) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) DisplayRuleGroup[] array = (DisplayRuleGroup[])(object)new DisplayRuleGroup[Mathf.Max(0, count)]; for (int i = 0; i < array.Length; i++) { array[i] = DisplayRuleGroup.empty; } return array; } } internal static class PodlessSpawn { internal static void Apply(GameObject bodyPrefab) { //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) CharacterBody val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val)) { return; } val.preferredPodPrefab = null; EntityStateMachine[] components = bodyPrefab.GetComponents(); foreach (EntityStateMachine val2 in components) { if (!(val2.customName != "Body")) { Type stateType = ((SerializableEntityStateType)(ref val2.initialStateType)).stateType; Type stateType2 = ((SerializableEntityStateType)(ref val2.mainStateType)).stateType; if (!(stateType == stateType2)) { Plugin.Log.LogInfo((object)(((Object)bodyPrefab).name + ": body machine started in " + ((stateType != null) ? stateType.Name : "nothing") + " with no pod to leave; starting in " + ((stateType2 != null) ? stateType2.Name : "nothing") + " instead.")); val2.initialStateType = val2.mainStateType; } } } } } internal sealed class RootedArmorController : MonoBehaviour { internal const float BonusArmor = 300f; private CharacterBody body; private int rootedCount; private static int active; private static bool hooked; internal bool IsRooted => rootedCount > 0; internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!hooked) { hooked = true; CharacterBody.RecalculateStats += new hook_RecalculateStats(AddRootedArmor); } } private void Awake() { body = ((Component)this).GetComponent(); } private void OnEnable() { active++; } internal void Push() { rootedCount++; if (Object.op_Implicit((Object)(object)body)) { body.MarkAllStatsDirty(); } } internal void Pop() { rootedCount = Mathf.Max(0, rootedCount - 1); if (Object.op_Implicit((Object)(object)body)) { body.MarkAllStatsDirty(); } } private void OnDisable() { rootedCount = 0; active = Mathf.Max(0, active - 1); } private static void AddRootedArmor(orig_RecalculateStats original, CharacterBody self) { original.Invoke(self); if (active > 0 && Object.op_Implicit((Object)(object)self)) { RootedArmorController component = ((Component)self).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.IsRooted) { self.armor += 300f; } } } internal static RootedArmorController Find(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } return ((Component)body).GetComponent(); } } [DefaultExecutionOrder(10000)] internal sealed class SixEyesController : MonoBehaviour { private CharacterBody body; private TemporaryVisualEffect suppressedBarrierEffect; private Renderer[] barrierRenderers; private Light[] barrierLights; private float stopwatch; private void Awake() { body = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { return; } stopwatch += Time.fixedDeltaTime; if (stopwatch < 1f) { return; } stopwatch -= 1f; HealthComponent healthComponent = body.healthComponent; float num = healthComponent.fullCombinedHealth * Mathf.Max(0f, JujutsuConfig.BarrierPerSecond.Value); if (num <= 0f) { return; } float num2 = healthComponent.fullHealth - healthComponent.health; if (num2 > 0f) { float num3 = Mathf.Min(num, num2); healthComponent.Heal(num3, default(ProcChainMask), false); num -= num3; if (num <= 0f) { return; } } float num4 = healthComponent.fullCombinedHealth * Mathf.Max(0f, JujutsuConfig.BarrierCap.Value) - healthComponent.barrier; if (!(num4 <= 0f)) { healthComponent.AddBarrier(Mathf.Min(num, num4)); } } private void LateUpdate() { if (Object.op_Implicit((Object)(object)body)) { TemporaryVisualEffect barrierTempEffectInstance = body.barrierTempEffectInstance; if ((Object)(object)barrierTempEffectInstance != (Object)(object)suppressedBarrierEffect) { suppressedBarrierEffect = barrierTempEffectInstance; Transform val = ((Object.op_Implicit((Object)(object)barrierTempEffectInstance) && Object.op_Implicit((Object)(object)barrierTempEffectInstance.visualTransform)) ? barrierTempEffectInstance.visualTransform : (Object.op_Implicit((Object)(object)barrierTempEffectInstance) ? ((Component)barrierTempEffectInstance).transform : null)); barrierRenderers = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponentsInChildren(true) : null); barrierLights = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponentsInChildren(true) : null); } DisableComponents(barrierRenderers); DisableComponents(barrierLights); } } private static void DisableComponents(Renderer[] renderers) { if (renderers == null) { return; } for (int i = 0; i < renderers.Length; i++) { if (Object.op_Implicit((Object)(object)renderers[i])) { renderers[i].enabled = false; } } } private static void DisableComponents(Light[] lights) { if (lights == null) { return; } for (int i = 0; i < lights.Length; i++) { if (Object.op_Implicit((Object)(object)lights[i])) { ((Behaviour)lights[i]).enabled = false; } } } } internal static class SkinIndexGuard { internal static void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ModelSkinController.ApplySkin += new hook_ApplySkin(ApplySkin); ModelSkinController.ApplySkinAsync += new hook_ApplySkinAsync(ApplySkinAsync); } private static void ApplySkin(orig_ApplySkin original, ModelSkinController self, int skinIndex) { int num = Clamp(self, skinIndex); Plugin.Log.LogInfo((object)$"ApplySkin {skinIndex} -> {num} on {((Object)self).name}."); TextureAudit.NoteSkin($"{((Object)self).name}#{num}"); original.Invoke(self, num); JujutsuNeckFit.NotifySkinApplied(((Component)self).gameObject, num); SukunaMixamoAnimationDriver.NotifySkinApplied(((Component)self).gameObject, num); } private static IEnumerator ApplySkinAsync(orig_ApplySkinAsync original, ModelSkinController self, int skinIndex, AsyncReferenceHandleUnloadType unloadType) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) int num = Clamp(self, skinIndex); TextureAudit.NoteSkin($"{((Object)self).name}#{num}"); return FitAfter(original.Invoke(self, num, unloadType), self, num); } private static IEnumerator FitAfter(IEnumerator inner, ModelSkinController self, int applied) { while (inner != null && inner.MoveNext()) { yield return inner.Current; } if (Object.op_Implicit((Object)(object)self)) { JujutsuNeckFit.NotifySkinApplied(((Component)self).gameObject, applied); SukunaMixamoAnimationDriver.NotifySkinApplied(((Component)self).gameObject, applied); } } private static int Clamp(ModelSkinController controller, int skinIndex) { int num = ((Object.op_Implicit((Object)(object)controller) && controller.skins != null) ? controller.skins.Length : 0); if (num <= 0) { return 0; } int num2 = Mathf.Clamp(skinIndex, 0, num - 1); if (num2 != skinIndex) { Plugin.Log.LogInfo((object)($"Skin {skinIndex} does not exist on " + $"{((Object)controller).name} ({num} available); " + $"using {num2} instead.")); } return num2; } } internal sealed class SpawnVoiceController : MonoBehaviour { private const float Delay = 0.7f; [SerializeField] private string owner = "Gojo"; private CharacterBody body; private float remaining = 0.7f; private bool spoken; internal void UseVoice(string who) { owner = who; } internal void UseSukunaVoice() { UseVoice("Sukuna"); } private void Awake() { body = ((Component)this).GetComponent(); } private void OnEnable() { remaining = 0.7f; spoken = false; } private void Update() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (spoken || !Object.op_Implicit((Object)(object)body)) { return; } remaining -= Time.deltaTime; if (!(remaining > 0f)) { spoken = true; if (body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive) { JujutsuCharacter jujutsuCharacter = JujutsuCharacters.For(owner); GojoAssets.PlayAttackSound((jujutsuCharacter != null && jujutsuCharacter.SpawnLine != null) ? jujutsuCharacter.SpawnLine() : null, body.corePosition, 0.85f, 0f, owner, spokenLine: true); } } } } }