Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of YujiItadori v1.4.1
plugins/YujiItadori/YujiItadori.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using EntityStates; using GojoSatoruMod.Components; using GojoSatoruMod.Content; using GojoSatoruMod.Guide; using GojoSatoruMod.States; using GojoSatoruMod.Visuals; using KinematicCharacterController; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.CharacterAI; using RoR2.Skills; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("YujiItadori")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.4.1.0")] [assembly: AssemblyInformationalVersion("1.4.1+821034880680daa23233a71eadd31af6da27dc72")] [assembly: AssemblyProduct("YujiItadori")] [assembly: AssemblyTitle("YujiItadori")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace GojoSatoruMod.Yuji { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("dev.marmennz.satorugojo", "1.4.1")] [BepInPlugin("dev.marmennz.yujiitadori", "Yuji Itadori", "1.4.1")] public sealed class YujiPlugin : BaseUnityPlugin { public const string PluginGuid = "dev.marmennz.yujiitadori"; public const string PluginVersion = "1.4.1"; public const string PluginName = "Yuji Itadori"; private void Awake() { if (JujutsuCoreContract.Accepts(1, "Yuji Itadori", "1.4.1", ((BaseUnityPlugin)this).Logger)) { int num = JujutsuStartup.FailureMark(); JujutsuStartup.UseHost((MonoBehaviour)(object)this); JujutsuAssetPaths.AddPlugin(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); JujutsuStartup.Step("Yuji's text", (Action)YujiLanguage.Register); JujutsuStartup.Step("Yuji's assets", (Action)YujiAssets.Initialize); JujutsuStartup.Step("Yuji's voice", (Func<IEnumerator>)YujiAssets.LoadVoices); JujutsuStartup.Step("Yuji's flow buff", (Action)YujiBuffs.Register); JujutsuStartup.Step("Yuji's vessel", (Action)YujiVessel.Initialize); JujutsuStartup.Step("Yuji's flow", (Action)delegate { JujutsuHitSync.Register("yuji-flow-claim", 12f, (Action<CharacterBody, Vector3, Vector3, float, bool>)YujiVessel.LandFlow); }); JujutsuStartup.Survivor("Yuji", (Action)YujiSurvivor.Initialize); JujutsuStartup.Loaded("Yuji Itadori", "1.4.1", num, ((BaseUnityPlugin)this).Logger); } } } internal static class GeneratedVersion { internal const string Value = "1.4.1"; } } namespace GojoSatoruMod.Visuals { internal static class YujiExtraSkins { private sealed class Part { internal string Name; internal int Outfit; internal string Texture; internal bool IsCutout; internal Vector3[] Vertices; internal Vector3[] Normals; internal Vector2[] Uvs; internal BoneWeight[] Weights; internal int[] Triangles; } private const string ModelFileName = "yuji-skins.model"; private const string TextureDirectoryName = "yuji-skins"; private static readonly string[] SkinNames = new string[6] { "SECOND", "THIRD", "FOURTH", "FIFTH", "SIXTH", "SEVENTH" }; private static readonly (Color Primary, Color Secondary)[] SkinIconColors = new(Color, Color)[6] { (new Color(0.9f, 0.42f, 0.3f), new Color(0.28f, 0.11f, 0.09f)), (new Color(0.62f, 0.66f, 0.72f), new Color(0.18f, 0.2f, 0.24f)), (new Color(0.45f, 0.58f, 0.86f), new Color(0.13f, 0.17f, 0.29f)), (new Color(0.78f, 0.72f, 0.36f), new Color(0.24f, 0.21f, 0.1f)), (new Color(0.36f, 0.62f, 0.45f), new Color(0.11f, 0.2f, 0.14f)), (new Color(0.07f, 0.09f, 0.2f), new Color(0.62f, 0.1f, 0.09f)) }; private static readonly Dictionary<string, Texture2D> textureCache = new Dictionary<string, Texture2D>(); private static string[] boneNames; private static Matrix4x4[] rest; private static List<Part> parts; private static readonly HashSet<int> applied = new HashSet<int>(); private static bool reportedMaterial; internal static void RegisterOnPrefab(GameObject bodyPrefab) { try { ModelSkinController val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponentInChildren<ModelSkinController>(true) : null); if (!Object.op_Implicit((Object)(object)val)) { return; } if (!File.Exists(JujutsuAssetPaths.Find(new string[2] { "assets", "yuji-skins.model" }))) { Plugin.Log.LogInfo((object)"skins: model absent file=yuji-skins.model offered=default", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); 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 i = 0; i < array.Length; i++) { array[i] = MakeGroup(val2, "YujiOutfit" + SkinNames[i]); array[i].SetActive(false); } GameObject val3 = MakeGroup(val2, "YujiOutfitDEFAULT"); val3.SetActive(true); SkinnedMeshRenderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val4 in componentsInChildren) { if ((Object)(object)((Component)val4).gameObject != (Object)(object)val3 && !IsInside(((Component)val4).transform, array) && !((Component)val4).transform.IsChildOf(val3.transform)) { ((Component)val4).transform.SetParent(val3.transform, true); } } List<GameObject> ownMeshes = new List<GameObject> { val3 }; List<SkinDef> list = new List<SkinDef> { BuildSkin("DEFAULT", -1, 0, ((Component)val2).gameObject, array, ownMeshes) }; for (int k = 0; k < array.Length; k++) { list.Add(BuildSkin(SkinNames[k], k, k + 1, ((Component)val2).gameObject, array, ownMeshes)); } val.skins = list.ToArray(); Plugin.Log.LogInfo((object)$"skins: registered count={list.Count} prefab={((Object)bodyPrefab).name}", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } catch (Exception arg) { Plugin.Log.LogError((object)$"skins: register failed ex={arg}", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } } private static void ReportRest(Transform[] bones, Transform root) { //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_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_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_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_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_00d3: 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_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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0169: 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_0181: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix; string[] array = new string[6] { "mixamorig:Hips", "mixamorig:Spine", "mixamorig:Head", "mixamorig:LeftArm", "mixamorig:LeftHand", "mixamorig:LeftFoot" }; foreach (string text in array) { int num = Array.IndexOf(boneNames, text); if (num >= 0 && Object.op_Implicit((Object)(object)bones[num])) { Vector3 val = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(bones[num].position); Vector3 val2 = Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(3)); Matrix4x4 val3 = worldToLocalMatrix * bones[num].localToWorldMatrix; Vector3 val4 = Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(2)); val3 = worldToLocalMatrix * bones[num].localToWorldMatrix; float num2 = Quaternion.Angle(Quaternion.LookRotation(val4, Vector4.op_Implicit(((Matrix4x4)(ref val3)).GetColumn(1))), Quaternion.LookRotation(Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(2)), Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(1)))); Plugin.Log.LogInfo((object)("skins: rest bone=" + text + " live=" + $"({val.x:0.000},{val.y:0.000},{val.z:0.000}) file=" + $"({val2.x:0.000},{val2.y:0.000},{val2.z:0.000}) " + $"twistDeg={num2:0.0}"), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } } } private static GameObject MakeGroup(Transform root, string name) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) Transform val = root.Find(name); object obj = (Object.op_Implicit((Object)(object)val) ? ((object)((Component)val).gameObject) : ((object)new GameObject(name))); ((GameObject)obj).layer = ((Component)root).gameObject.layer; ((GameObject)obj).transform.SetParent(root, false); return (GameObject)obj; } private static bool IsInside(Transform candidate, GameObject[] groups) { foreach (GameObject val in groups) { if (candidate.IsChildOf(val.transform)) { return true; } } return false; } private static SkinDef BuildSkin(string skinName, int shown, int colorIndex, GameObject root, GameObject[] groups, List<GameObject> ownMeshes) { //IL_00f5: 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_013f: 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) SkinDef val = ScriptableObject.CreateInstance<SkinDef>(); ((Object)val).name = "skinYuji" + skinName; val.nameToken = "CODEX_YUJI_SKIN_" + skinName + "_NAME"; int index = Mathf.Clamp(colorIndex, 0, SkinIconColors.Length - 1); val.icon = GojoAssets.LoadIcon("yuji-skin-" + skinName.ToLowerInvariant(), (Func<Sprite>)(() => GojoAssets.CreateSkinIcon("texYujiSkin" + skinName, SkinIconColors[index].Primary, SkinIconColors[index].Secondary))); val.rootObject = root; val.baseSkins = Array.Empty<SkinDef>(); val.unlockableDef = null; SkinDefParams val2 = ScriptableObject.CreateInstance<SkinDefParams>(); ((Object)val2).name = "skinParamsYuji" + skinName; val2.rendererInfos = Array.Empty<RendererInfo>(); val2.meshReplacements = Array.Empty<MeshReplacement>(); val2.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); val2.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); List<GameObjectActivation> list = new List<GameObjectActivation>(); for (int num = 0; num < groups.Length; num++) { list.Add(new GameObjectActivation { gameObject = groups[num], shouldActivate = (num == shown) }); } foreach (GameObject ownMesh in ownMeshes) { list.Add(new GameObjectActivation { gameObject = ownMesh, shouldActivate = (shown < 0) }); } val2.gameObjectActivations = list.ToArray(); val.skinDefParams = val2; val.Bake(); return val; } internal static void Apply(CharacterModel characterModel) { try { if (!Object.op_Implicit((Object)(object)characterModel)) { return; } GameObject[] array = FindGroups(characterModel); if (array == null || !Load() || !applied.Add(((Object)characterModel).GetInstanceID())) { return; } SkinnedMeshRenderer val = FindTemplate(characterModel); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)"skins: skipped template=none", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); return; } int found; Transform[] bones = ResolveBones(characterModel, out found); Plugin.Log.LogInfo((object)$"skins: bones resolved found={found} total={boneNames.Length}", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); if (found < boneNames.Length / 2) { Plugin.Log.LogWarning((object)"skins: skipped bones=too few", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); return; } MeasureAgainstRig(bones, ((Component)characterModel).transform, out var bindPoses, out var offsets, out var scale); ReportRest(bones, ((Component)characterModel).transform); int num = 0; float[] array2 = new float[array.Length]; for (int i = 0; i < array2.Length; i++) { array2[i] = float.MinValue; } foreach (Part part in parts) { if ((uint)part.Outfit < (uint)array.Length) { float num2 = BuildRenderer(part, bones, bindPoses, offsets, scale, val, array[part.Outfit].transform); if (!IsDecal(part) && num2 > array2[part.Outfit]) { array2[part.Outfit] = num2; } num++; } } JujutsuNeckFit.NoteOutfitHeights(array2); Plugin.Log.LogInfo((object)$"skins: built renderers={num} model={((Object)characterModel).name}", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } catch (Exception arg) { Plugin.Log.LogError((object)$"skins: apply failed ex={arg}", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } } private static SkinnedMeshRenderer FindTemplate(CharacterModel characterModel) { SkinnedMeshRenderer val = null; SkinnedMeshRenderer[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2.sharedMesh) && !((Object)(object)((Renderer)val2).sharedMaterial == (Object)null) && ((Object)(object)val == (Object)null || val2.sharedMesh.vertexCount > val.sharedMesh.vertexCount)) { val = val2; } } return val; } 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("YujiOutfit" + SkinNames[i]); if (!Object.op_Implicit((Object)(object)val)) { return null; } array[i] = ((Component)val).gameObject; } return array; } private static Transform[] ResolveBones(CharacterModel characterModel, out int found) { Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(StringComparer.Ordinal); Transform[] componentsInChildren = ((Component)characterModel).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (!dictionary.ContainsKey(((Object)val).name)) { dictionary[((Object)val).name] = val; } } found = 0; Transform[] array = (Transform[])(object)new Transform[boneNames.Length]; for (int j = 0; j < boneNames.Length; j++) { if (dictionary.TryGetValue(boneNames[j], out var value)) { array[j] = value; found++; continue; } foreach (KeyValuePair<string, Transform> item in dictionary) { if (item.Key.EndsWith(boneNames[j], StringComparison.Ordinal)) { array[j] = item.Value; found++; break; } } if (!Object.op_Implicit((Object)(object)array[j])) { array[j] = ((Component)characterModel).transform; } } return array; } private static Vector3 ToRigSpace(Vector3 stored) { //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_0013: Unknown result type (might be due to invalid IL or missing references) return new Vector3(stored.x, stored.z, 0f - stored.y); } private static float MeasureScale(Transform[] bones, Matrix4x4 toRoot) { //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_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_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_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) int num = Array.IndexOf(boneNames, "mixamorig:Hips"); int num2 = Array.IndexOf(boneNames, "mixamorig:Head"); if (num < 0 || num2 < 0 || !Object.op_Implicit((Object)(object)bones[num]) || !Object.op_Implicit((Object)(object)bones[num2])) { return 1f; } float num3 = Vector3.Distance(((Matrix4x4)(ref toRoot)).MultiplyPoint3x4(bones[num].position), ((Matrix4x4)(ref toRoot)).MultiplyPoint3x4(bones[num2].position)); float num4 = Vector3.Distance(Vector4.op_Implicit(((Matrix4x4)(ref rest[num])).GetColumn(3)), Vector4.op_Implicit(((Matrix4x4)(ref rest[num2])).GetColumn(3))); if (!(num4 > 0.0001f)) { return 1f; } return num3 / num4; } private static void MeasureAgainstRig(Transform[] bones, Transform root, out Matrix4x4[] bindPoses, out Vector3[] offsets, out float scale) { //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_001e: 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_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_0033: 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_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_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //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) bindPoses = (Matrix4x4[])(object)new Matrix4x4[bones.Length]; offsets = (Vector3[])(object)new Vector3[bones.Length]; Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix; scale = MeasureScale(bones, worldToLocalMatrix); for (int i = 0; i < bones.Length; i++) { Matrix4x4 val = (Object.op_Implicit((Object)(object)bones[i]) ? (worldToLocalMatrix * bones[i].localToWorldMatrix) : Matrix4x4.identity); bindPoses[i] = ((Matrix4x4)(ref val)).inverse; offsets[i] = Vector4.op_Implicit(((Matrix4x4)(ref val)).GetColumn(3)) - ToRigSpace(Vector4.op_Implicit(((Matrix4x4)(ref rest[i])).GetColumn(3))) * scale; } Plugin.Log.LogInfo((object)$"skins: fit scale={scale:0.000} axes=zup->yup", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } private static float BuildRenderer(Part part, Transform[] bones, Matrix4x4[] bindPoses, Vector3[] offsets, float scale, 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_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_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_0084: 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_00a2: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0110: 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_01ca: 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_0125: 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_011e: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) int num = part.Vertices.Length; Mesh val = new Mesh { name = "meshYuji_" + part.Name, indexFormat = (IndexFormat)(num > 65000) }; Vector3[] array = (Vector3[])(object)new Vector3[num]; Vector3[] array2 = (Vector3[])(object)new Vector3[num]; float num2 = float.MinValue; for (int i = 0; i < num; i++) { BoneWeight val2 = part.Weights[i]; Vector3 val3 = offsets[((BoneWeight)(ref val2)).boneIndex0] * ((BoneWeight)(ref val2)).weight0 + offsets[((BoneWeight)(ref val2)).boneIndex1] * ((BoneWeight)(ref val2)).weight1 + offsets[((BoneWeight)(ref val2)).boneIndex2] * ((BoneWeight)(ref val2)).weight2 + offsets[((BoneWeight)(ref val2)).boneIndex3] * ((BoneWeight)(ref val2)).weight3; float num3 = ((BoneWeight)(ref val2)).weight0 + ((BoneWeight)(ref val2)).weight1 + ((BoneWeight)(ref val2)).weight2 + ((BoneWeight)(ref val2)).weight3; array[i] = ToRigSpace(part.Vertices[i]) * scale + ((num3 > 0.0001f) ? (val3 / num3) : Vector3.zero); array2[i] = ToRigSpace(part.Normals[i]); if (array[i].y > num2) { num2 = array[i].y; } } val.vertices = array; val.normals = array2; val.uv = part.Uvs; val.boneWeights = part.Weights; val.bindposes = bindPoses; val.triangles = part.Triangles; val.RecalculateBounds(); GameObject val4 = new GameObject(part.Name) { layer = ((Component)parent).gameObject.layer }; val4.transform.SetParent(parent, false); SkinnedMeshRenderer obj = val4.AddComponent<SkinnedMeshRenderer>(); obj.sharedMesh = val; obj.bones = bones; obj.rootBone = ((bones.Length != 0 && Object.op_Implicit((Object)(object)bones[0])) ? bones[0] : parent); ((Renderer)obj).sharedMaterial = BuildMaterial(template, part); obj.quality = (SkinQuality)4; obj.updateWhenOffscreen = true; return num2; } private static Material BuildMaterial(SkinnedMeshRenderer template, Part part) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) Material val = Object.Instantiate<Material>(((Renderer)template).sharedMaterial); ((Object)val).name = "matYujiSkin_" + part.Name; Texture2D val2 = LoadTexture(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); } if (IsDecal(part)) { val.SetFloat("_EnableCutout", 1f); val.EnableKeyword("CUTOUT"); ReportMaterial(val, part); } return val; } private static void ReportMaterial(Material material, Part part) { //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) if (!reportedMaterial) { reportedMaterial = true; string[] obj = new string[8] { "_EnableCutout", "_Cutoff", "_Mode", "_SrcBlend", "_DstBlend", "_ZWrite", "_MainTex", "_Color" }; StringBuilder stringBuilder = new StringBuilder(); string[] array = obj; foreach (string text in array) { stringBuilder.Append(text).Append('=').Append(material.HasProperty(text) ? "yes " : "no "); } Texture val = (material.HasProperty("_MainTex") ? material.GetTexture("_MainTex") : null); JujutsuLog log = Plugin.Log; string[] obj2 = new string[11] { "skins: decal part=", part.Name, " texture=", part.Texture, " loaded=", Object.op_Implicit((Object)(object)val) ? (val.width + "x" + val.height) : "none", " format=", null, null, null, null }; Texture2D val2 = (Texture2D)(object)((val is Texture2D) ? val : null); obj2[7] = ((val2 != null) ? ((object)val2.format/*cast due to .constrained prefix*/).ToString() : "?"); obj2[8] = " "; Shader shader = material.shader; obj2[9] = $"shader='{((shader != null) ? ((Object)shader).name : null)}' queue={material.renderQueue} "; obj2[10] = string.Format("{0}keywords={1}", stringBuilder, string.Join(",", material.shaderKeywords)); log.LogInfo((object)string.Concat(obj2), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); } } private static bool IsDecal(Part part) { return part.Name.IndexOf("decal", StringComparison.OrdinalIgnoreCase) >= 0; } private static Texture2D LoadTexture(string textureName) { if (string.IsNullOrEmpty(textureName)) { return Texture2D.whiteTexture; } if (textureCache.TryGetValue(textureName, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } string text = JujutsuAssetPaths.Find(new string[3] { "assets", "yuji-skins", textureName }); bool flag = File.Exists(text); TextureAudit.Record("yuji-skins", textureName, flag); if (!flag) { Plugin.Log.LogWarning((object)("skins: texture not found path=" + text), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); return Texture2D.whiteTexture; } Texture2D val = JujutsuTextures.Load(text, "texYujiSkin_" + Path.GetFileNameWithoutExtension(textureName), (TextureWrapMode)1, false, (Action<Texture2D>)null); if (!Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogWarning((object)("skins: texture decode failed path=" + text), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); return Texture2D.whiteTexture; } textureCache[textureName] = val; return val; } private static bool Load() { //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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_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_016a: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0236: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) if (parts != null) { return parts.Count > 0; } parts = new List<Part>(); string path = JujutsuAssetPaths.Find(new string[2] { "assets", "yuji-skins.model" }); if (!File.Exists(path)) { Plugin.Log.LogInfo((object)"skins: model absent file=yuji-skins.model", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); return false; } using FileStream input = File.OpenRead(path); using BinaryReader binaryReader = new BinaryReader(input); if (new string(binaryReader.ReadChars(8)) != "SUKNMDL1") { throw new InvalidDataException("Yuji skin model header is invalid."); } int num = binaryReader.ReadInt32(); if (num != 2) { throw new InvalidDataException($"Unsupported Yuji skin model version {num}."); } int num2 = binaryReader.ReadInt32(); boneNames = new string[num2]; int[] array = new int[num2]; Matrix4x4[] array2 = (Matrix4x4[])(object)new Matrix4x4[num2]; for (int i = 0; i < num2; i++) { boneNames[i] = binaryReader.ReadString(); array[i] = binaryReader.ReadInt32(); Vector3 val = ReadVector3(binaryReader); Quaternion val2 = ReadQuaternion(binaryReader); Vector3 val3 = ReadVector3(binaryReader); array2[i] = Matrix4x4.TRS(val, val2, val3); } rest = (Matrix4x4[])(object)new Matrix4x4[num2]; for (int j = 0; j < num2; j++) { rest[j] = ((array[j] < 0) ? array2[j] : (rest[array[j]] * array2[j])); } int num3 = binaryReader.ReadInt32(); for (int k = 0; k < num3; k++) { Part part = new Part { Name = binaryReader.ReadString(), Outfit = binaryReader.ReadInt32() }; 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 val4 = default(BoneWeight); ((BoneWeight)(ref val4)).boneIndex0 = binaryReader.ReadInt32(); ((BoneWeight)(ref val4)).boneIndex1 = binaryReader.ReadInt32(); ((BoneWeight)(ref val4)).boneIndex2 = binaryReader.ReadInt32(); ((BoneWeight)(ref val4)).boneIndex3 = binaryReader.ReadInt32(); ((BoneWeight)(ref val4)).weight0 = binaryReader.ReadSingle(); ((BoneWeight)(ref val4)).weight1 = binaryReader.ReadSingle(); ((BoneWeight)(ref val4)).weight2 = binaryReader.ReadSingle(); ((BoneWeight)(ref val4)).weight3 = binaryReader.ReadSingle(); weights[num5] = val4; } 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)SkinNames.Length) { parts.Add(part); } } Plugin.Log.LogInfo((object)$"skins: loaded parts={parts.Count} bones={num2}", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiExtraSkins.cs"); return parts.Count > 0; } 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()); } } internal static class YujiFlowAuraTextures { private static Texture2D shellRamp; private static Texture2D inkTongue; private static Texture2D smear; internal static Texture2D ShellRamp { get { if (!Object.op_Implicit((Object)(object)shellRamp)) { return shellRamp = BuildFlat("texYujiFlowShellRamp", 64, ShadeShell); } return shellRamp; } } internal static Texture2D InkTongue { get { if (!Object.op_Implicit((Object)(object)inkTongue)) { return inkTongue = JujutsuFxTextures.Build("texYujiFlowInkTongue", 128, (Func<float, float, Color32>)ShadeInk); } return inkTongue; } } internal static Texture2D Smear { get { if (!Object.op_Implicit((Object)(object)smear)) { return smear = JujutsuFxTextures.Build("texYujiFlowSmear", 128, (Func<float, float, Color32>)ShadeSmear); } return smear; } } private static Texture2D BuildFlat(string name, int size, Func<float, float, Color32> shade) { //IL_0004: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //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) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false) { name = name, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61 }; Color32[] array = (Color32[])(object)new Color32[size * size]; for (int i = 0; i < size; i++) { float arg = ((float)i + 0.5f) / (float)size; for (int j = 0; j < size; j++) { float arg2 = ((float)j + 0.5f) / (float)size; array[i * size + j] = shade(arg2, arg); } } val.SetPixels32(array); val.Apply(false, false); return val; } private static Color32 ShadeShell(float u, float v) { //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_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_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) //IL_0076: 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_00ad: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) float num = Step(0.32f, 0.38f, u); float num2 = Step(0.47f, 0.53f, u); float num3 = 0.9f + 0.2f * v; Color val = Color.Lerp(new Color(YujiFlowGlow.ShellFill.r * num3, YujiFlowGlow.ShellFill.g * num3, YujiFlowGlow.ShellFill.b * num3, 1f), YujiFlowGlow.ShellRim, num); val = Color.Lerp(val, YujiFlowGlow.ShellInk, num2); float num4 = 0.3f * (1f - num) + 0.62f * num; num4 = num4 * (1f - num2) + 0.86f * num2; return Color32.op_Implicit(new Color(Mathf.Clamp01(val.r), Mathf.Clamp01(val.g), Mathf.Clamp01(val.b), Mathf.Clamp01(num4))); } private static Color32 ShadeInk(float u, float v) { //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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_0116: 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_012e: 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) float x = Mathf.Abs(v - 0.5f) * 2f; float num = (0.9f + 0.06f * Mathf.Sin(u * 5f + 1f) + 0.04f * Mathf.Sin(u * 9f + 2.3f)) * (1f - 0.4f * u * u); float num2 = Step(num, num - 0.05f, x); float num3 = Step(num - 0.22f - 0.04f, num - 0.22f + 0.04f, x); float num4 = Step(0.25f, 0.6f, u); Color val = Color.Lerp(Color.Lerp(YujiFlowGlow.ShellFill, YujiFlowGlow.TongueInk, num4), YujiFlowGlow.ShellRim, num3); float num5 = (0.55f * (1f - num4) + 0.88f * num4) * (1f - num3) + 0.92f * num3; num5 *= num2; num5 *= Step(0f, 0.1f, u) * (1f - Step(0.86f, 1f, u)); return Color32.op_Implicit(new Color(Mathf.Clamp01(val.r), Mathf.Clamp01(val.g), Mathf.Clamp01(val.b), Mathf.Clamp01(num5))); } private static Color32 ShadeSmear(float u, float v) { //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_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_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_0065: 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_0096: 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_010a: 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_0122: 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_013a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(v - 0.5f) * 2f; float num2 = Step(0.94f, 0.9f, num); float num3 = Step(0.83000004f, 0.89f, num); float num4 = Step(0.64f, 0.72f, num); Color val = Color.Lerp(YujiFlowGlow.ShellFill, YujiFlowGlow.ShellRim, num4); val = Color.Lerp(val, YujiFlowGlow.ShellInk, num3); float num5 = Gauss(num - 0.22f) + Gauss(num - 0.48f); num5 *= (1f - num4) * 0.55f; val = Color.Lerp(val, YujiFlowGlow.ShellRim, num5); float num6 = 0.34f * (1f - num4) + 0.62f * num4; num6 = num6 * (1f - num3) + 0.72f * num3; num6 += num5 * 0.25f; num6 *= num2 * Step(0f, 0.05f, u) * (1f - Step(0.95f, 1f, u)); return Color32.op_Implicit(new Color(Mathf.Clamp01(val.r), Mathf.Clamp01(val.g), Mathf.Clamp01(val.b), Mathf.Clamp01(num6))); } private static float Gauss(float offset) { float num = offset / 0.05f; return Mathf.Exp((0f - num) * num); } private static float Step(float from, float to, float x) { float num = to - from; if (Mathf.Abs(num) < 1E-06f) { num = 1E-06f; } float num2 = Mathf.Clamp01((x - from) / num); return num2 * num2 * (3f - 2f * num2); } } internal struct YujiFlowArm { internal Vector3 Start; internal Vector3 Fist; internal Vector3 Axis; internal Vector3 Side1; internal Vector3 Side2; internal float WristS; internal float Span; internal Vector3 Point(float s) { //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_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_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) return Start + (Fist - Start) * s; } internal float Radius(float s) { float num = ((s < WristS) ? Mathf.Lerp(0.26f, 0.42f, s / Mathf.Max(1E-06f, WristS)) : Mathf.Lerp(0.42f, 0.58f, (s - WristS) / Mathf.Max(1E-06f, 1f - WristS))); return Span * num; } internal static float Wave(float theta, float s, float time) { return 0.1f * (0.5f + 0.5f * s) * (0.6f * Mathf.Sin(theta * 3f + time * 2.1f + s * 5f) + 0.4f * Mathf.Sin(theta * 5f - time * 3.3f + s * 8f)); } } internal sealed class YujiFlowShell { private sealed class MeshKeeper : MonoBehaviour { private Mesh mesh; internal void Own(Mesh owned) { mesh = owned; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } } private const float TuckAtElbow = 0.55f; private const float CapLift = 0.85f; private readonly GameObject host; private readonly Mesh mesh; private readonly MeshRenderer renderer; private readonly Material material; private readonly List<Vector3> vertices; private readonly List<Vector3> normals; private readonly List<Vector2> uvs; private readonly int rows; internal readonly int VertexCount; internal readonly int TriangleCount; internal bool Alive { get { if (Object.op_Implicit((Object)(object)host) && Object.op_Implicit((Object)(object)mesh)) { return Object.op_Implicit((Object)(object)renderer); } return false; } } private YujiFlowShell(GameObject host, Mesh mesh, MeshRenderer renderer, Material material) { //IL_006d: 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_008d: 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_009f: Unknown result type (might be due to invalid IL or missing references) this.host = host; this.mesh = mesh; this.renderer = renderer; this.material = material; rows = 23; int num = 28; int num2 = rows * num; vertices = new List<Vector3>(num2); normals = new List<Vector3>(num2); uvs = new List<Vector2>(num2); Color[] array = (Color[])(object)new Color[num2]; for (int i = 0; i < num2; i++) { vertices.Add(Vector3.zero); normals.Add(Vector3.up); uvs.Add(Vector2.zero); array[i] = Color.white; } int[] array2 = new int[(rows - 1) * num * 6]; int num3 = 0; for (int j = 0; j < rows - 1; j++) { for (int k = 0; k < num; k++) { int num4 = j * num + k; int num5 = j * num + (k + 1) % num; int num6 = (j + 1) * num + (k + 1) % num; int num7 = (j + 1) * num + k; array2[num3++] = num4; array2[num3++] = num5; array2[num3++] = num6; array2[num3++] = num4; array2[num3++] = num6; array2[num3++] = num7; } } mesh.MarkDynamic(); mesh.SetVertices(vertices); mesh.SetNormals(normals); mesh.SetUVs(0, uvs); mesh.colors = array; mesh.triangles = array2; VertexCount = num2; TriangleCount = array2.Length / 3; } internal static YujiFlowShell Create(string name, int queue) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Material val = JujutsuFxMaterials.CreateBlendedMaterial("matYujiFlowShell", YujiFlowGlow.AuraTint, YujiFlowAuraTextures.ShellRamp); if (!Object.op_Implicit((Object)(object)val)) { return null; } val.renderQueue = queue; Mesh owned = default(Mesh); MeshRenderer val2 = default(MeshRenderer); GameObject obj = JujutsuFxMesh.Object(name, ref owned, ref val2); ((Renderer)val2).sharedMaterial = val; JujutsuFxMaterials.Claim(obj, val); obj.AddComponent<MeshKeeper>().Own(owned); obj.SetActive(false); return new YujiFlowShell(obj, owned, val2, val); } internal void Level(float whole) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)material)) { JujutsuFxMaterials.SetEnvelope(material, YujiFlowGlow.AuraTint, whole, 1f); } } internal void Draw(YujiFlowArm arm, float time) { //IL_005a: 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_009c: 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_00c3: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mesh)) { return; } float num = JujutsuEase.FlickerScaled(time, 0.92f, 6f); float num2 = arm.Radius(1f) * num; for (int i = 0; i < 18; i++) { float s = (float)i / 17f; float num3 = arm.Radius(s) * num; if (i == 0) { num3 *= 0.55f; } Ring(arm, i, arm.Point(s), num3, s, 1f, time); } for (int j = 1; j <= 5; j++) { float num4 = (float)j / 5f * (MathF.PI / 2f); float num5 = Mathf.Cos(num4); Vector3 centre = arm.Fist + arm.Axis * (num2 * Mathf.Sin(num4) * 0.85f); Ring(arm, 17 + j, centre, num2 * num5, 1f, num5, time); } Normals(arm); Fresnel(); mesh.SetVertices(vertices); mesh.SetNormals(normals); mesh.SetUVs(0, uvs); mesh.RecalculateBounds(); } internal void Show(bool on) { if (Object.op_Implicit((Object)(object)host)) { host.SetActive(on); } } internal void Destroy() { if (Object.op_Implicit((Object)(object)host)) { Object.Destroy((Object)(object)host); } } private void Ring(YujiFlowArm arm, int row, Vector3 centre, float radius, float s, float waveScale, float time) { //IL_003b: 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_0048: 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_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_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_0084: Unknown result type (might be due to invalid IL or missing references) int num = 28; int num2 = row * num; for (int i = 0; i < num; i++) { float num3 = (float)i / (float)num * (MathF.PI * 2f); float num4 = radius * (1f + YujiFlowArm.Wave(num3, s, time) * waveScale); vertices[num2 + i] = centre + (arm.Side1 * Mathf.Cos(num3) + arm.Side2 * Mathf.Sin(num3)) * num4; uvs[num2 + i] = new Vector2(0f, s); } } private void Normals(YujiFlowArm arm) { //IL_0044: 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_006d: 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_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) //IL_0090: 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_00ab: Unknown result type (might be due to invalid IL or missing references) int num = 28; for (int i = 0; i < rows; i++) { int num2 = i * num; int num3 = Mathf.Min(rows - 1, i + 1) * num; int num4 = Mathf.Max(0, i - 1) * num; for (int j = 0; j < num; j++) { Vector3 val = vertices[num2 + (j + 1) % num] - vertices[num2 + (j + num - 1) % num]; Vector3 val2 = vertices[num3 + j] - vertices[num4 + j]; Vector3 val3 = Vector3.Cross(val, val2); normals[num2 + j] = ((((Vector3)(ref val3)).sqrMagnitude > 1E-18f) ? ((Vector3)(ref val3)).normalized : arm.Axis); } } } private void Fresnel() { //IL_001b: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_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_0048: 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_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_0078: 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) Camera main = Camera.main; Vector3 val = (Object.op_Implicit((Object)(object)main) ? ((Component)main).transform.position : Vector3.zero); for (int i = 0; i < uvs.Count; i++) { float x = 0f; if (Object.op_Implicit((Object)(object)main)) { Vector3 val2 = val - vertices[i]; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > 1E-12f) { val2 /= Mathf.Sqrt(sqrMagnitude); x = 1f - Mathf.Abs(Vector3.Dot(normals[i], val2)); } } Vector2 value = uvs[i]; value.x = x; uvs[i] = value; } } } internal sealed class YujiFlowGlow : MonoBehaviour { private sealed class Palm { private struct Tongue { internal float Start; internal float Theta; internal float Period; internal float Phase; internal float Length; internal float Seed; } private struct Ink { internal float S; internal float Spread; internal float Period; internal float Phase; internal float Length; internal float Width; internal float Seed; internal float Hook; } private Transform hand; private Transform knuckle; private Transform forearm; private TrailRenderer[] trails; private Material[] materials; private Color[] tints; private float[] glows; private Transform root; private ParticleSystem embers; private LineRenderer[] sleeves; private LineRenderer[] tongues; private Tongue[] rows; private Material[] flameMaterials; private Color[] flameTints; private float[] flameGlows; private Vector3[] tongueBuffer; private Vector3[] sleeveBuffer; private YujiFlowShell shell; private LineRenderer[] inkTongues; private Ink[] inkRows; private Material inkMaterial; private Vector3[] inkBuffer; private YujiFlowArm arm; private Vector3 lastWrist; private Vector3 velocity; private float lastSpark; private Vector3 start; private Vector3 fist; private Vector3 across; private Vector3 around; private float forearmLength; private float sheath; private float clock; private float span; private bool synthetic; private bool showing; internal bool Alive { get { if (trails == null || !Object.op_Implicit((Object)(object)hand) || !Object.op_Implicit((Object)(object)root)) { return false; } for (int i = 0; i < trails.Length; i++) { if (!Object.op_Implicit((Object)(object)trails[i])) { return false; } } if (tongues == null || sleeves == null) { return true; } if (!Object.op_Implicit((Object)(object)forearm) && !synthetic) { return false; } for (int j = 0; j < sleeves.Length; j++) { if (!Object.op_Implicit((Object)(object)sleeves[j])) { return false; } } for (int k = 0; k < tongues.Length; k++) { if (!Object.op_Implicit((Object)(object)tongues[k])) { return false; } } if (shell != null && !shell.Alive) { return false; } if (inkTongues != null) { for (int l = 0; l < inkTongues.Length; l++) { if (!Object.op_Implicit((Object)(object)inkTongues[l])) { return false; } } } return true; } } internal static Palm Build(Transform bone, float palm, float offset) { //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)bone)) { return null; } Palm palm2 = new Palm(); palm2.hand = bone; palm2.knuckle = Knuckle(bone); palm2.span = palm; palm2.clock = offset; palm2.lastWrist = bone.position; float x = bone.lossyScale.x; float num = ((x > 0.0001f) ? (palm * 0.75f / x) : (palm * 0.75f)); Vector3 offset2 = PalmDirection(bone) * num; palm2.MakeTrails(offset2, x); GameObject val = new GameObject("YujiFlowAura"); val.transform.position = bone.position; palm2.root = val.transform; palm2.MakeFlame(); return palm2; } private void MakeTrails(Vector3 offset, float handScale) { //IL_000f: 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) //IL_00bf: 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_0091: 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_00ef: 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_0109: Unknown result type (might be due to invalid IL or missing references) Material val = (Blended() ? JujutsuFxMaterials.CreateBlendedMaterial("matYujiFlowSmear", AuraTint, YujiFlowAuraTextures.Smear) : null); int num = ((!Object.op_Implicit((Object)(object)val)) ? 1 : 2); trails = (TrailRenderer[])(object)new TrailRenderer[num]; materials = (Material[])(object)new Material[num]; tints = (Color[])(object)new Color[num]; glows = new float[num]; int slot = 0; if (Object.op_Implicit((Object)(object)val)) { val.renderQueue = 3001; MakeTrail(slot++, "Smear", val, AuraTint, 1f, 0.22f, 1.15f, Stroke(SmearTailTint), offset, handScale); } Color val2 = YujiFx.LayerTint(FlowColour, (JujutsuFxLayer)0); val2.a = 0.32f; Material val3 = JujutsuFxMaterials.CreateLineMaterial("matYujiFlowTrailCore", val2, 4.4f, JujutsuFxTextures.Streak); if (Object.op_Implicit((Object)(object)val3)) { val3.renderQueue = 3003; } MakeTrail(slot, "Core", val3, val2, 4.4f, 0.09f, 0.26f, Stroke(Color.white), offset, handScale); } private void MakeTrail(int slot, string which, Material material, Color tint, float glow, float seconds, float width, Gradient gradient, Vector3 offset, float handScale) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0029: 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_00f7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("YujiFlowTrail" + which); val.transform.SetParent(hand, false); val.transform.localPosition = offset; TrailRenderer val2 = val.AddComponent<TrailRenderer>(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)val2); ((Renderer)val2).sharedMaterial = material; if (Object.op_Implicit((Object)(object)material)) { JujutsuFxMaterials.Claim(val, material); } val2.time = seconds; val2.minVertexDistance = 0.02f; val2.numCornerVertices = 3; val2.numCapVertices = 3; val2.autodestruct = false; val2.textureMode = (LineTextureMode)0; val2.alignment = (LineAlignment)0; float num = span * width; val2.widthMultiplier = ((handScale > 0.0001f) ? (num / handScale) : num); val2.widthCurve = JujutsuEase.Curve((Func<float, float>)((float t) => 1f - JujutsuEase.InCubic(t)), 8); val2.colorGradient = gradient; trails[slot] = val2; materials[slot] = material; tints[slot] = tint; glows[slot] = glow; } private static Gradient Stroke(Color tail) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //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) Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(tail, 1f) }, SmearAlphaKeys); return val; } private void MakeFlame() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (flameFailed) { return; } try { FindForearm(); MakeMaterials(); MakeSleeves(); MakeTongues(); MakeShell(); MakeInkTongues(); Frame(); Vector3 val = fist - start; sheath = ((Vector3)(ref val)).magnitude; } catch (Exception ex) { flameFailed = true; Plugin.Log.LogWarning((object)("flow aura: build failed fallback=trails-only latch=session ex=" + ex), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiFlowGlow.cs"); DropFlame(); } } private void MakeShell() { if (Blended()) { shell = YujiFlowShell.Create("YujiFlowShell", 3001); } } private void MakeInkTongues() { //IL_006e: 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_0199: 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_010b: 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_016d: 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) int num = 0; for (int i = 0; i < InkTongues.Length; i++) { num += (int)InkTongues[i].x; } inkRows = new Ink[Blended() ? num : 0]; inkTongues = (LineRenderer[])(object)new LineRenderer[inkRows.Length]; inkBuffer = (Vector3[])(object)new Vector3[9]; if (inkRows.Length == 0) { return; } inkMaterial = JujutsuFxMaterials.CreateBlendedMaterial("matYujiFlowInkTongue", AuraTint, YujiFlowAuraTextures.InkTongue); if (Object.op_Implicit((Object)(object)inkMaterial)) { inkMaterial.renderQueue = 3002; JujutsuFxMaterials.Claim(((Component)root).gameObject, inkMaterial); } AnimationCurve widthCurve = JujutsuEase.Curve((Func<float, float>)((float t) => (0.8f + 0.45f * Mathf.Sin(MathF.PI * t)) * (1f - 0.85f * Mathf.Pow(t, 2.2f))), 9); int num2 = 0; for (int num3 = 0; num3 < InkTongues.Length; num3++) { Vector4 val = InkTongues[num3]; for (int num4 = 0; num4 < (int)val.x; num4++) { inkRows[num2] = InkRow(num2, val.y, val.z, val.w); LineRenderer val2 = MakeLine("YujiFlowInkTongue" + num2, 9, inkMaterial); val2.widthCurve = widthCurve; val2.widthMultiplier = span * inkRows[num2].Width; val2.startColor = Color.white; val2.endColor = Color.white; inkTongues[num2] = val2; num2++; } } } private static Ink InkRow(int index, float low, float high, float width) { Ink result = default(Ink); result.S = Mathf.Lerp(InkBaseS.x, InkBaseS.y, Hash01(index, 61)); result.Spread = (Hash01(index, 62) * 2f - 1f) * 1.6f; result.Period = Mathf.Lerp(InkPeriod.x, InkPeriod.y, Hash01(index, 63)); result.Phase = Hash01(index, 64); result.Length = Mathf.Lerp(low, high, Hash01(index, 65)); result.Width = width; result.Seed = Hash01(index, 66) * (MathF.PI * 2f); result.Hook = ((Hash01(index, 67) > 0.5f) ? 1f : (-1f)); return result; } private static bool Blended() { if (JujutsuFxMaterials.CanDrawDark) { return true; } if (!darkRefused) { darkRefused = true; Plugin.Log.LogInfo((object)"flow aura: no alpha-blended shader outline=off glow=on", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiFlowGlow.cs"); } return false; } private void FindForearm() { //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) Transform val = (Object.op_Implicit((Object)(object)hand) ? hand.parent : null); if (Object.op_Implicit((Object)(object)val)) { float num = Vector3.Distance(hand.position, val.position); if (num >= span * 0.5f && num <= span * 4f) { forearm = val; forearmLength = num; synthetic = false; return; } } forearm = null; forearmLength = 0f; synthetic = true; } private void MakeMaterials() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: 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_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) flameMaterials = (Material[])(object)new Material[FlameNames.Length]; flameTints = (Color[])(object)new Color[FlameNames.Length]; flameGlows = new float[FlameNames.Length]; Texture2D streak = JujutsuFxTextures.Streak; Texture2D blade = JujutsuFxTextures.Blade; for (int i = 0; i < FlameNames.Length; i++) { JujutsuFxLayer val = FlameLayers[i]; Color val2 = YujiFx.LayerTint(FlowColour, val); val2.a = FlameAlphas[i]; float num = JujutsuFxMaterials.GlowFor(val); Material val3 = JujutsuFxMaterials.CreateLineMaterial(FlameNames[i], val2, num, FlameWearsBlade[i] ? blade : streak); flameMaterials[i] = val3; flameTints[i] = val2; flameGlows[i] = num; if (Object.op_Implicit((Object)(object)val3)) { val3.renderQueue = ((i < SleeveNames.Length) ? 3000 : 3003); JujutsuFxMaterials.Claim(((Component)root).gameObject, val3); } } } private void MakeSleeves() { //IL_0071: 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) sleeves = (LineRenderer[])(object)new LineRenderer[SleeveNames.Length]; sleeveBuffer = (Vector3[])(object)new Vector3[7]; AnimationCurve widthCurve = JujutsuEase.Curve((Func<float, float>)((float t) => Mathf.Lerp(0.27f, 0.33f, t) / 0.33f), 8); for (int num = 0; num < sleeves.Length; num++) { LineRenderer val = MakeLine("YujiFlowSleeve" + SleeveNames[num], 7, flameMaterials[num]); val.widthCurve = widthCurve; val.startColor = Color.white; val.endColor = Color.white; sleeves[num] = val; } } private void MakeTongues() { //IL_0072: 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_00ea: Unknown result type (might be due to invalid IL or missing references) int num = 9; tongues = (LineRenderer[])(object)new LineRenderer[num]; rows = new Tongue[num]; tongueBuffer = (Vector3[])(object)new Vector3[7]; int num2 = 0; for (int i = 0; i < TongueCounts.Length; i++) { float tip = TongueTips[i]; AnimationCurve widthCurve = JujutsuEase.Curve((Func<float, float>)((float t) => Mathf.Lerp(1f, tip, JujutsuEase.InQuad(t))), 8); for (int num3 = 0; num3 < TongueCounts[i]; num3++) { rows[num2] = Row(num3, TongueSalts[i], TongueLengths[i]); LineRenderer val = MakeLine("YujiFlowTongue" + num2, 7, flameMaterials[SleeveNames.Length + i]); val.widthCurve = widthCurve; val.widthMultiplier = span * TongueWidths[i]; val.startColor = Color.white; val.endColor = new Color(1f, 1f, 1f, 0f); tongues[num2] = val; num2++; } } } private static Tongue Row(int index, int salt, Vector2 length) { //IL_0094: 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) Tongue result = default(Tongue); result.Start = 0.04f + Mathf.Repeat((float)index * 0.618034f + Hash01(index, salt) * 0.15f, 0.92f); result.Theta = Mathf.Repeat((float)index * 2.3999631f + Hash01(index, salt + 10) * 0.8f, MathF.PI * 2f); result.Period = Mathf.Lerp(LickPeriod.x, LickPeriod.y, Hash01(index, salt + 20)); result.Phase = Hash01(index, salt + 30); result.Length = Mathf.Lerp(length.x, length.y, Hash01(index, salt + 40)); result.Seed = Hash01(index, salt + 50) * (MathF.PI * 2f); return result; } private LineRenderer MakeLine(string name, int points, Material material) { //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(name); val.transform.SetParent(root, false); LineRenderer obj = val.AddComponent<LineRenderer>(); JujutsuFxMaterials.PrepareRenderer((Renderer)(object)obj); obj.useWorldSpace = true; obj.positionCount = points; obj.numCornerVertices = 4; obj.numCapVertices = 4; obj.textureMode = (LineTextureMode)0; obj.alignment = (LineAlignment)0; ((Renderer)obj).sharedMaterial = material; return obj; } internal string Report() { if (tongues == null) { return $"palm={span:0.000}m aura=none"; } string arg = (Object.op_Implicit((Object)(object)forearm) ? $"forearm='{((Object)forearm).name}' forearmLen={forearmLength:0.000}m" : "forearm=synthetic"); string arg2 = ((shell != null) ? ($"shellVerts={shell.VertexCount} " + $"shellTris={shell.TriangleCount}") : "shell=none reason=no-blended-shader"); int num = ((inkTongues != null) ? inkTongues.Length : 0); return $"palm={span:0.000}m {arg} sheath={sheath:0.000}m " + $"{arg2} ink={num} haze={0} " + $"body={6} core={3} sleeveMax=" + $"{span * 0.33f * 3.2f:0.000}m " + $"smear={span * 1.15f:0.000}m"; } internal void Follow(float level) { //IL_0026: 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_005a: 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) if (Object.op_Implicit((Object)(object)root) && Object.op_Implicit((Object)(object)hand)) { root.position = hand.position; } if (materials != null) { for (int i = 0; i < materials.Length; i++) { if (Object.op_Implicit((Object)(object)materials[i])) { JujutsuFxMaterials.SetEnvelope(materials[i], tints[i], level, glows[i]); } } } if (flameMaterials != null) { for (int j = 0; j < flameMaterials.Length; j++) { if (Object.op_Implicit((Object)(object)flameMaterials[j])) { JujutsuFxMaterials.SetEnvelope(flameMaterials[j], flameTints[j], level, flameGlows[j]); } } } if (shell != null) { shell.Level(level); } if (Object.op_Implicit((Object)(object)inkMaterial)) { JujutsuFxMaterials.SetEnvelope(inkMaterial, AuraTint, level, 1f); } Burn(); } private void Burn() { //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_0063: 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_00de: 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_0091: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (tongues == null || !Object.op_Implicit((Object)(object)hand)) { return; } try { float num = Time.time + clock; Track(); Frame(); float magnitude = ((Vector3)(ref velocity)).magnitude; float num2 = 0f; Vector3 drag = Vector3.zero; if (magnitude > 0.0001f) { num2 = Mathf.Min(1f, magnitude / 6f); drag = velocity * ((0f - num2) / magnitude); } if (magnitude > 4f && num - lastSpark >= 0.22f) { lastSpark = num; JujutsuMotes.Burst(fist, velocity / (0f - magnitude), FlowColour, span * 1.2f, (JujutsuMoteKind)2, 5); } DrawSleeves(num); if (shell != null) { shell.Draw(arm, num); } DrawInkTongues(num, drag, num2); DrawTongues(num, drag); } catch (Exception ex) { flameFailed = true; Plugin.Log.LogWarning((object)("flow aura: draw threw off=session ex=" + ex), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Yuji\\Visuals\\YujiFlowGlow.cs"); DropFlame(); } } private void Track() { //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_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_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_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_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_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_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_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) Vector3 position = hand.position; Vector3 val = (position - lastWrist) / Mathf.Max(Time.deltaTime, 0.0001f); lastWrist = position; if (((Vector3)(ref val)).sqrMagnitude > 1600f) { val = Vector3.zero; } velocity = Vector3.Lerp(velocity, val, 1f - Mathf.Exp((0f - Time.deltaTime) * 12f)); velocity = Vector3.ClampMagnitude(velocity, 12f); } private void Frame() { //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_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_0013: 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_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_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_0046: 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_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_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_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_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) //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_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_0098: 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_009a: 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_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_00c9: 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_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_00fc: 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_00fe: 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_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) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_0155: 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_0166: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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) //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_00b4: 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_00bf: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) Vector3 position = hand.position; Vector3 val = PalmAxis(position); Vector3 val2 = (Object.op_Implicit((Object)(object)forearm) ? forearm.position : (position - val * (span * 2f))); start = val2 + (position - val2) * 0.35f; fist = position + val * (span * 1.12f); Vector3 val3 = Normalized(fist - start); Vector3 value = Vector3.Cross(val3, Vector3.up); if (((Vector3)(ref value)).magnitude < 0.05f) { value = Vector3.Cross(val3, Vector3.right); } across = Normalized(value); around = Normalized(Vector3.Cross(val3, across)); arm.Span = span; arm.Start = val2 + (position - val2) * 0.35f; arm.Fist = fist; arm.Axis = Normalized(fist - arm.Start); ref YujiFlowArm reference = ref arm; Vector3 val4 = position - arm.Start; float magnitude = ((Vector3)(ref val4)).magnitude; val4 = fist - arm.Start; reference.WristS = magnitude / Mathf.Max(1E-06f, ((Vector3)(ref val4)).magnitude); Vector3 value2 = Vector3.Cross(arm.Axis, Vector3.up); if (((Vector3)(ref value2)).magnitude < 0.05f) { value2 = Vector3.Cross(arm.Axis, Vector3.right); } arm.Side1 = Normalized(value2); arm.Side2 = Normalized(Vector3.Cross(arm.Axis, arm.Side1)); } private Vector3 PalmAxis(Vector3 wrist) { //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_004b: 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_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_002f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)knuckle)) { Vector3 val = knuckle.position - wrist; if (((Vector3)(ref val)).sqrMagnitude > 1E-06f) { return ((Vector3)(ref val)).normalized; } } return Normalized(hand.TransformDirection(PalmDirection(hand))); } private Vector3 Point(float s) { //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_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_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) return start + (fist - start) * s; } private float Radius(float s) { return span * Mathf.Lerp(0.27f, 0.33f, s); } private void DrawSleeves(float now) { //IL_0064: 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_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) for (int i = 0; i < sleeves.Length; i++) { LineRenderer val = sleeves[i]; if (Object.op_Implicit((Object)(object)val)) { float num = SleeveOffsets[i]; for (int j = 0; j < 7; j++) { float num2 = (float)j / 6f; float num3 = Mathf.Sin(now * 5.3f + num2 * 4f + num) * span * 0.03f; sleeveBuffer[j] = Point(num2) + across * num3; } val.SetPositions(sleeveBuffer); float num4 = JujutsuEase.FlickerScaled(now + num, 0.85f, 7f); val.widthMultiplier = span * 0.33f * SleeveWidths[i] * num4; } } } private void DrawInkTongues(float now, Vector3 drag, float pull) { //IL_0089: 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_009e: 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_0146: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_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) //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_00e1: 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_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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: 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_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_02f8: 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_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) if (inkTongues == null) { return; } Color val9 = default(Color); for (int i = 0; i < inkTongues.Length; i++) { LineRenderer val = inkTongues[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } Ink ink = inkRows[i]; float num = Mathf.Repeat(now / ink.Period + ink.Phase, 1f); float num2 = Mathf.Pow(Mathf.Max(0f, Mathf.Sin(num * MathF.PI)), 0.7f); if (num2 < 0.02f) { ((Renderer)val).enabled = false; continue; } ((Renderer)val).enabled = true; float num3 = Mathf.Atan2(Vector3.Dot(Vector3.up, arm.Side2), Vector3.Dot(Vector3.up, arm.Side1)) + ink.Spread; if (pull > 0f) { float num4 = Mathf.Repeat(Mathf.Atan2(Vector3.Dot(drag, arm.Side2), Vector3.Dot(drag, arm.Side1)) - num3 + MathF.PI, MathF.PI * 2f) - MathF.PI; num3 += num4 * pull * 0.8f; } num3 += 0.25f * Mathf.Sin(now * 1.3f + ink.Seed); float s = ink.S; Vector3 val2 = arm.Side1 * Mathf.Cos(num3) + arm.Side2 * Mathf.Sin(num3); float num5 = arm.Radius(s) * (1f + YujiFlowArm.Wave(num3, s, now)); Vector3 val3 = arm.Point(s) + val2 * (num5 * 0.95f); Vector3 val4 = Normalized(val2 * 0.6f + Vector3.up * 0.9f + drag * 1.1f); Vector3 val5 = Vector3.Cross(val4, arm.Axis); if (((Vector3)(ref val5)).magnitude < 0.05f) { val5 = Vector3.Cross(val4, Vector3.up); } if (((Vector3)(ref val5)).magnitude < 0.05f) { val5 = Vector3.Cross(val4, Vector3.right); } val5 = Normalized(val5); float num6 = span * ink.Length * (0.35f + 0.65f * num2) / 8f; Vector3 val6 = val3; inkBuffer[0] = val3; for (int j = 1; j < 9; j++) { float num7 = (float)j / 8f; Vector3 val7 = Quaternion.AngleAxis(1.4f * ink.Hook * num7 * num7 * 57.29578f, val5) * val4; float num8 = span * 0.35f * num7; float num9 = now * 6.5f + num7 * 2.5f + ink.Seed; Vector3 val8 = val5 * (Mathf.Sin(num9) * num8 * 0.5f); val6 += val7 * num6; inkBuffer[j] = val6 + val8; } val.SetPositions(inkBuffer); ((Color)(ref val9))..ctor(1f, 1f, 1f, num2); val.startColor = val9; val.endColor = val9; } } private void DrawTongues(float now, Vector3 drag) { //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_00cf: 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_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_00ef: 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_010b: 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_0117: 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_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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be