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 NaoyaZenin v1.3.1
plugins/NaoyaZenin/NaoyaZenin.dll
Decompiled 2 hours 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 BepInEx; using BepInEx.Configuration; using EntityStates; using GojoSatoruMod.Components; using GojoSatoruMod.Content; using GojoSatoruMod.States; using GojoSatoruMod.Visuals; using KinematicCharacterController; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.ExpansionManagement; using RoR2.Skills; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [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("NaoyaZenin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.1.0")] [assembly: AssemblyInformationalVersion("1.3.1+4bfea71e3ca88fd38135ba73f70b6801fa7b0366")] [assembly: AssemblyProduct("NaoyaZenin")] [assembly: AssemblyTitle("NaoyaZenin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace GojoSatoruMod.Visuals { internal static class NaoyaCurseModel { private const string ModelFileName = "curse-form.model"; private const string TextureFolder = "curse-form"; private static Mesh mesh; private static Material material; private static bool loadFailed; internal static bool Available => EnsureLoaded(); internal static GameObject Draw(Transform parent, float height) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)parent) || !EnsureLoaded()) { return null; } GameObject val = new GameObject("NaoyaCurseShell"); val.transform.SetParent(parent, false); Bounds bounds = mesh.bounds; float num = Mathf.Max(0.01f, ((Bounds)(ref bounds)).size.y); val.transform.localScale = Vector3.one * (height / num); val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)obj).receiveShadows = true; return val; } private static bool EnsureLoaded() { if (Object.op_Implicit((Object)(object)mesh)) { return true; } if (loadFailed) { return false; } string text = JujutsuAssetPaths.Find(new string[2] { "assets", "curse-form.model" }); if (!File.Exists(text)) { loadFailed = true; Plugin.Log.LogWarning((object)("Naoya's curse form was not found at " + text + "; the ghost will wear the donor body instead of the chrysalis."), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaCurseModel.cs"); return false; } try { Read(text); return true; } catch (Exception arg) { loadFailed = true; mesh = null; material = null; Plugin.Log.LogWarning((object)("Naoya's curse form could not be read; the ghost will " + $"wear the donor body instead: {arg}"), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaCurseModel.cs"); return false; } } private static void Read(string path) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) using FileStream input = File.OpenRead(path); using BinaryReader binaryReader = new BinaryReader(input); string text = new string(binaryReader.ReadChars(8)); if (text != "SUKNMDL1") { throw new InvalidDataException("Bad magic '" + text + "'."); } int num = binaryReader.ReadInt32(); if (num != 2) { throw new InvalidDataException($"Bad version {num}."); } int num2 = binaryReader.ReadInt32(); for (int i = 0; i < num2; i++) { binaryReader.ReadString(); binaryReader.ReadInt32(); for (int j = 0; j < 10; j++) { binaryReader.ReadSingle(); } } if (binaryReader.ReadInt32() < 1) { throw new InvalidDataException("No parts."); } binaryReader.ReadString(); binaryReader.ReadInt32(); string text2 = binaryReader.ReadString(); string text3 = binaryReader.ReadString(); binaryReader.ReadByte(); int num3 = binaryReader.ReadInt32(); Vector3[] array = (Vector3[])(object)new Vector3[num3]; Vector3[] array2 = (Vector3[])(object)new Vector3[num3]; Vector2[] array3 = (Vector2[])(object)new Vector2[num3]; for (int k = 0; k < num3; k++) { array[k] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); array2[k] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); array3[k] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); binaryReader.ReadSingle(); } int num4 = binaryReader.ReadInt32(); int[] array4 = new int[num4]; for (int l = 0; l < num4; l++) { array4[l] = binaryReader.ReadInt32(); } mesh = new Mesh { name = "meshNaoyaCurse", hideFlags = (HideFlags)61 }; mesh.vertices = array; mesh.normals = array2; mesh.uv = array3; mesh.triangles = array4; mesh.RecalculateBounds(); material = JujutsuFxMaterials.CreateSurfaceMaterial("matNaoyaCurse" + text2, Color.white); if (Object.op_Implicit((Object)(object)material)) { ((Object)material).hideFlags = (HideFlags)61; Texture2D val = GojoAssets.LoadPersistentTexture("curse-form/" + text3, "texNaoyaCurse"); if (Object.op_Implicit((Object)(object)val) && material.HasProperty("_MainTex")) { material.SetTexture("_MainTex", (Texture)(object)val); } if (material.HasProperty("_Color")) { material.SetColor("_Color", Color.white); } if (material.HasProperty("_EmissionColor")) { material.SetColor("_EmissionColor", Color.black); material.DisableKeyword("_EMISSION"); } } Plugin.Log.LogInfo((object)($"Naoya's curse form read: {num3} vertices, " + $"{num4 / 3} triangles, texture '{text3}'" + (Object.op_Implicit((Object)(object)material) ? "." : ", but no material could be built.")), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaCurseModel.cs"); } } internal static class NaoyaGhosts { internal const float Seconds = 0.32f; private const float Hold = 0.2f; private const float Alpha = 0.42f; private static bool warned; internal static bool Cast(CharacterBody body, Color colour) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0061: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { return false; } if (JujutsuFxBudget.Available((Kind)3, 1) < 1) { return false; } SkinnedMeshRenderer[] componentsInChildren = ((Component)body.modelLocator.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>(); if (componentsInChildren == null || componentsInChildren.Length == 0) { return false; } GameObject val = new GameObject("NaoyaGhost"); val.transform.position = body.corePosition; NaoyaGhost naoyaGhost = val.AddComponent<NaoyaGhost>(); Material val2 = JujutsuFxMaterials.CreateLineMaterial("matNaoyaGhost", colour, 1.6f, (Texture2D)null); JujutsuFxMaterials.Claim(val, val2); int num = 0; for (int i = 0; i < componentsInChildren.Length; i++) { if (Bake(componentsInChildren[i], val.transform, val2, naoyaGhost)) { num++; } } if (num == 0) { Object.Destroy((Object)(object)val); return false; } Color tint = colour; tint.a = 0.42f; naoyaGhost.Configure(val2, tint, 0.32f, 0.2f); JujutsuFxBudget.Register(val, (Kind)3); return true; } private static bool Bake(SkinnedMeshRenderer part, Transform root, Material material, NaoyaGhost ghost) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)part) || !Object.op_Implicit((Object)(object)part.sharedMesh) || !((Renderer)part).enabled || !((Component)part).gameObject.activeInHierarchy) { return false; } Mesh val = new Mesh { name = "meshNaoyaGhost" }; try { part.BakeMesh(val); } catch (Exception ex) { if (!warned) { warned = true; Plugin.Log.LogWarning((object)("Naoya's afterimage could not bake " + ((Object)part).name + ": " + ex.Message), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaGhosts.cs"); } Object.Destroy((Object)(object)val); return false; } GameObject val2 = new GameObject(((Object)part).name + "Ghost"); val2.transform.SetParent(((Component)part).transform, false); val2.transform.SetParent(root, true); val2.AddComponent<MeshFilter>().sharedMesh = val; MeshRenderer obj = val2.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; JujutsuFxMaterials.PrepareRenderer((Renderer)(object)obj); ghost.Own(val); return true; } } internal sealed class NaoyaGhost : MonoBehaviour { private readonly List<Mesh> owned = new List<Mesh>(16); private Material material; private Color colour; private float life = 0.32f; private float hold; private float age; internal void Configure(Material ownedMaterial, Color tint, float seconds, float holdShare) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) material = ownedMaterial; colour = tint; life = Mathf.Max(0.05f, seconds); hold = Mathf.Clamp01(holdShare); JujutsuFxMaterials.SetEnvelopeSnap(material, colour, 0f, 1.6f, hold); } internal void Own(Mesh mesh) { if (Object.op_Implicit((Object)(object)mesh)) { owned.Add(mesh); } } private void Update() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; if (age >= life) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { JujutsuFxMaterials.SetEnvelopeSnap(material, colour, age / life, 1.6f, hold); } } private void OnDestroy() { for (int i = 0; i < owned.Count; i++) { if (Object.op_Implicit((Object)(object)owned[i])) { Object.Destroy((Object)(object)owned[i]); } } owned.Clear(); } } internal static class NaoyaGlass { internal const float FormSeconds = 0.09f; internal const float ReleaseSeconds = 0.26f; private const float Tiling = 2.4f; internal static readonly Color Tint = new Color(1.05f, 1.05f, 1.05f, 1f); private static readonly Color Pane = new Color(0.4f, 0.62f, 0.58f, 1f); internal static readonly Color Seam = Color.Lerp(NaoyaLanguage.Colour, Color.white, 0.62f); private const int Cells = 5; private const float SeamWidth = 0.115f; private static Texture2D texture; private static Texture2D ramp; private static Material material; private static bool materialResolved; private static bool hooked; internal static Texture2D Texture { get { if (!Object.op_Implicit((Object)(object)texture)) { return texture = Build(); } return texture; } } internal static Texture2D Ramp { get { if (!Object.op_Implicit((Object)(object)ramp)) { return ramp = BuildRamp(); } return ramp; } } internal static Material Material { get { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0065: 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_0097: Unknown result type (might be due to invalid IL or missing references) if (materialResolved) { return material; } materialResolved = true; Material brittleMaterial = CharacterModel.brittleMaterial; if (!Object.op_Implicit((Object)(object)brittleMaterial)) { JujutsuLog log = Plugin.Log; if (log != null) { log.LogWarning((object)"Naoya's glass has no material to build from — the game's brittle overlay is not loaded. A framed body will still be frozen and still take the extra damage; it simply will not look like glass.", "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaGlass.cs"); } return null; } material = new Material(brittleMaterial) { name = "matNaoyaGlass", hideFlags = (HideFlags)61 }; material.SetColor("_TintColor", Tint); material.SetTexture("_MainTex", (Texture)(object)Texture); material.SetTextureScale("_MainTex", Vector2.one * 2.4f); material.SetTexture("_RemapTex", (Texture)(object)Ramp); JujutsuLog log2 = Plugin.Log; if (log2 != null) { string[] obj = new string[8] { "Naoya's glass built from the game's brittle overlay: shader '", null, null, null, null, null, null, null }; Shader shader = material.shader; obj[1] = ((shader != null) ? ((Object)shader).name : null); obj[2] = "', sheet "; Texture2D obj2 = Texture; obj[3] = $"'{((obj2 != null) ? ((Object)obj2).name : null)}' tiled {2.4f:0.0}x, ramp "; obj[4] = "'"; Texture2D obj3 = Ramp; obj[5] = ((obj3 != null) ? ((Object)obj3).name : null); obj[6] = "', remap "; obj[7] = ((material.GetFloat("_DisableRemapOn") > 0.5f) ? "off." : "on."); log2.LogInfo((object)string.Concat(obj), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaGlass.cs"); } return material; } } internal static void Initialize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!hooked) { hooked = true; CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(Glaze); JujutsuGlassSfx.Warm(); } } private static void Glaze(orig_OnBuffFirstStackGained original, CharacterBody self, BuffDef buffDef) { original.Invoke(self, buffDef); if (!Object.op_Implicit((Object)(object)NaoyaBuffs.Framed) || (Object)(object)buffDef != (Object)(object)NaoyaBuffs.Framed || !Object.op_Implicit((Object)(object)self)) { return; } try { NaoyaGlassSkin.Cast(self); } catch (Exception arg) { JujutsuLog log = Plugin.Log; if (log != null) { log.LogWarning((object)("Naoya's glass could not be put on " + ((Object)self).name + "; the " + $"freeze itself is unaffected: {arg}"), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaGlass.cs"); } } } private static Texture2D Build() { Texture2D obj = JujutsuFxTextures.Build("texNaoyaGlassShell", 256, (Func<float, float, Color32>)Sample); ((Texture)obj).wrapMode = (TextureWrapMode)0; return obj; } private static Texture2D BuildRamp() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_0071: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 2, (TextureFormat)4, false) { name = "texNaoyaGlassRamp", wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61 }; Color32[] array = (Color32[])(object)new Color32[128]; Color32 val3 = default(Color32); for (int i = 0; i < 64; i++) { float num = ((float)i + 0.5f) / 64f; Color val2 = ((num <= 0.35f) ? (Pane * (num / 0.35f)) : Color.Lerp(Pane, Seam, Mathf.Clamp01((num - 0.35f) / 0.5f))); ((Color32)(ref val3))..ctor((byte)Mathf.RoundToInt(Mathf.Clamp01(val2.r) * 255f), (byte)Mathf.RoundToInt(Mathf.Clamp01(val2.g) * 255f), (byte)Mathf.RoundToInt(Mathf.Clamp01(val2.b) * 255f), (byte)Mathf.RoundToInt(Mathf.Clamp01(num) * 255f)); for (int j = 0; j < 2; j++) { array[j * 64 + i] = val3; } } val.SetPixels32(array); val.Apply(false, false); return val; } private static Color32 Sample(float u, float v) { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) float num = u * 5f; float num2 = v * 5f; int num3 = Mathf.FloorToInt(num); int num4 = Mathf.FloorToInt(num2); float num5 = float.MaxValue; float num6 = float.MaxValue; float num7 = 0f; float num8 = 0f; int x = 0; int y = 0; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { int num9 = num3 + j; int num10 = num4 + i; int num11 = Wrap(num9); int num12 = Wrap(num10); float num13 = (float)num9 + 0.16f + 0.68f * Hash(num11, num12, 17); float num14 = (float)num10 + 0.16f + 0.68f * Hash(num11, num12, 91); float num15 = num13 - num; float num16 = num14 - num2; float num17 = Mathf.Sqrt(num15 * num15 + num16 * num16); if (num17 < num5) { num6 = num5; num5 = num17; num7 = num15; num8 = num16; x = num11; y = num12; } else if (num17 < num6) { num6 = num17; } } } float num18 = Mathf.Clamp01(1f - (num6 - num5) / 0.115f); num18 = num18 * num18 * num18; float num19 = Hash(x, y, 233) * MathF.PI * 2f; float num20 = (0f - num7) * Mathf.Cos(num19) - num8 * Mathf.Sin(num19); float num21 = Mathf.Clamp01(0.5f + num20 * 1.5f) * (0.55f + 0.45f * Hash(x, y, 401)); Color val = Pane * (num21 * 0.46f) + Seam * (num18 * 0.95f); float num22 = Mathf.Clamp01(num21 * 0.38f + num18); return new Color32((byte)Mathf.RoundToInt(Mathf.Clamp01(val.r) * 255f), (byte)Mathf.RoundToInt(Mathf.Clamp01(val.g) * 255f), (byte)Mathf.RoundToInt(Mathf.Clamp01(val.b) * 255f), (byte)Mathf.RoundToInt(num22 * 255f)); } private static int Wrap(int index) { int num = index % 5; if (num >= 0) { return num; } return num + 5; } private static float Hash(int x, int y, int seed) { int num = x * 374761393 + y * 668265263 + seed * 1442695040; int num2 = (num ^ (num >> 13)) * 1274126177; return (float)((num2 ^ (num2 >> 16)) & 0xFFFFFF) / 16777215f; } } internal sealed class NaoyaGlassSkin : MonoBehaviour { private const int Shards = 6; private const float PatienceSeconds = 0.5f; private static readonly int ExternalAlpha = Shader.PropertyToID("_ExternalAlpha"); private static bool failureLogged; private CharacterBody body; private TemporaryOverlayInstance overlay; private float age; private float waited; private float alpha; private float releasing = -1f; internal static void Cast(CharacterBody victim) { if (Object.op_Implicit((Object)(object)victim) && !failureLogged) { NaoyaGlassSkin naoyaGlassSkin = ((Component)victim).GetComponent<NaoyaGlassSkin>(); if (!Object.op_Implicit((Object)(object)naoyaGlassSkin)) { naoyaGlassSkin = ((Component)victim).gameObject.AddComponent<NaoyaGlassSkin>(); } ((Behaviour)naoyaGlassSkin).enabled = true; naoyaGlassSkin.Begin(); } } private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private void Begin() { age = alpha * 0.09f; waited = 0f; releasing = -1f; } private void Update() { try { Draw(); } catch (Exception arg) { failureLogged = true; JujutsuLog log = Plugin.Log; if (log != null) { log.LogWarning((object)("Naoya's glass failed and has been switched off; the " + $"freeze itself is unaffected: {arg}"), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaGlass.cs"); } Sleep(); } } private void Draw() { if (overlay == null && !Attach()) { waited += Time.deltaTime; if (waited > 0.5f) { Sleep(); } return; } if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)NaoyaBuffs.Framed) && body.HasBuff(NaoyaBuffs.Framed)) { releasing = -1f; age += Time.deltaTime; SetAlpha(JujutsuEase.OutCubic(Mathf.Clamp01(age / 0.09f))); return; } if (releasing < 0f) { releasing = 0f; Shatter(); } releasing += Time.deltaTime; float num = Mathf.Clamp01(releasing / 0.26f); SetAlpha(1f - JujutsuEase.InQuad(num)); if (num >= 1f) { Sleep(); } } private void Sleep() { Detach(); waited = 0f; releasing = -1f; age = 0f; alpha = 0f; ((Behaviour)this).enabled = false; } private bool Attach() { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator)) { return false; } Transform modelTransform = body.modelLocator.modelTransform; if (!Object.op_Implicit((Object)(object)modelTransform)) { return false; } CharacterModel component = ((Component)modelTransform).GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } Material material = NaoyaGlass.Material; if (!Object.op_Implicit((Object)(object)material)) { return false; } overlay = TemporaryOverlayManager.AddOverlay(((Component)modelTransform).gameObject); overlay.originalMaterial = material; overlay.animateShaderAlpha = false; overlay.duration = 0f; overlay.destroyComponentOnEnd = true; overlay.destroyObjectOnEnd = false; overlay.AddToCharacterModel(component); NoItemDisplaysController.Keep(overlay.materialInstance); SetAlpha(0f); return true; } private void Shatter() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { JujutsuFxDebris.Throw(body.corePosition, Vector3.up, NaoyaGlass.Seam, Mathf.Max(0.6f, body.radius), 6, 0f, 1f); JujutsuGlassSfx.PlayShatter(body.corePosition, Mathf.Max(0.6f, body.radius), 0.3f); } } private void SetAlpha(float value) { alpha = Mathf.Clamp01(value); Material val = overlay?.materialInstance; if (Object.op_Implicit((Object)(object)val)) { val.SetFloat(ExternalAlpha, alpha); } } private void OnDestroy() { Detach(); } private void Detach() { if (overlay != null) { NoItemDisplaysController.Forget(overlay.materialInstance); overlay.Destroy(); overlay = null; } } } internal sealed class NaoyaGlassCase : MonoBehaviour { private const float Grace = 0.35f; private const float Squash = 0.12f; private const float Spread = 1.12f; private const float FrameMargin = 1.3664f; private const float PressSeconds = 0.12f; private readonly List<NaoyaPane> panes = new List<NaoyaPane>(1); private readonly List<Vector3> offsets = new List<Vector3>(1); private CharacterBody body; private float age; private float life; private bool marked; private bool closed; private Vector3 forward; private Transform model; private Animator animator; private Vector3 heldScale; private Quaternion heldRotation = Quaternion.identity; private float heldAnimatorSpeed = 1f; private bool holdingModel; private float press; private Vector3 Anchor { get { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!holdingModel || !Object.op_Implicit((Object)(object)model)) { return ((Component)this).transform.position; } return model.position; } } internal static void Stand(CharacterBody victim, Vector3 heading, float seconds, Color? tint = null) { //IL_002c: 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_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)victim)) { NaoyaGlassCase naoyaGlassCase = ((Component)victim).GetComponent<NaoyaGlassCase>(); if (!Object.op_Implicit((Object)(object)naoyaGlassCase)) { naoyaGlassCase = ((Component)victim).gameObject.AddComponent<NaoyaGlassCase>(); } ((Behaviour)naoyaGlassCase).enabled = true; naoyaGlassCase.Build(heading, seconds, (Color)(((??)tint) ?? NaoyaLanguage.Colour)); } } internal static void Break(CharacterBody victim) { if (victim != null) { ((Component)victim).GetComponent<NaoyaGlassCase>()?.Shatter(); } } private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private void Build(Vector3 heading, float seconds, Color tint) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_006c: 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_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_00b7: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) NaoyaPanes.Close(panes, heading, finished: false); offsets.Clear(); age = 0f; life = Mathf.Max(0.2f, seconds) + 0.35f; marked = false; closed = false; forward = Vector3.ProjectOnPlane(heading, Vector3.up); forward = ((((Vector3)(ref forward)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref forward)).normalized : Vector3.forward); if (Object.op_Implicit((Object)(object)body)) { Seize(); float halfWidth; float halfHeight; Vector3 centre = Middle(out halfWidth, out halfHeight); Vector3 val = ((holdingModel && Object.op_Implicit((Object)(object)model)) ? model.lossyScale : Vector3.one); NaoyaPanes.Case(panes, centre, forward, halfWidth / Safe(val.x), halfHeight / Safe(val.y), tint, life); Hang(); Vector3 anchor = Anchor; for (int i = 0; i < panes.Count; i++) { offsets.Add(Object.op_Implicit((Object)(object)panes[i]) ? (((Component)panes[i]).transform.position - anchor) : Vector3.zero); } } } private static float Safe(float scale) { if (!(Mathf.Abs(scale) > 0.0001f)) { return 1f; } return Mathf.Abs(scale); } private void Hang() { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!holdingModel || !Object.op_Implicit((Object)(object)model)) { return; } for (int i = 0; i < panes.Count; i++) { NaoyaPane naoyaPane = panes[i]; if (Object.op_Implicit((Object)(object)naoyaPane)) { Transform transform = ((Component)naoyaPane).transform; transform.SetParent(model, true); Vector3 localPosition = transform.localPosition; localPosition.z = 0f; transform.localPosition = localPosition; transform.localRotation = Quaternion.identity; } } } private Vector3 Middle(out float halfWidth, out float halfHeight) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (holdingModel && Object.op_Implicit((Object)(object)model) && Measure(out var bounds)) { Vector3 extents = ((Bounds)(ref bounds)).extents; halfHeight = Mathf.Clamp(extents.y * 1.3664f, 0.85f, 18f); halfWidth = Mathf.Clamp(Mathf.Max(Mathf.Max(extents.x, extents.z) * 1.3664f, halfHeight * 0.42f), 0.6f, 18f); Plugin.Log.LogInfo((object)($"Naoya's frame round {((Object)this).name}: {halfWidth * 2f:0.#}x" + $"{halfHeight * 2f:0.#}m off a drawn box of " + $"{((Bounds)(ref bounds)).size.x:0.#}x{((Bounds)(ref bounds)).size.y:0.#}x" + $"{((Bounds)(ref bounds)).size.z:0.#}m, hung on the model."), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\Visuals\\NaoyaGlassCase.cs"); return ((Bounds)(ref bounds)).center; } float num = body.corePosition.y - ((Component)this).transform.position.y; halfHeight = Mathf.Max(0.85f, num * 1.35f); halfWidth = Mathf.Max(Mathf.Max(0.6f, body.radius * 1.6f), halfHeight * 0.5f); return ((Component)this).transform.position + Vector3.up * Mathf.Max(0.65f, num); } private bool Measure(out Bounds bounds) { //IL_0001: 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_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) bounds = default(Bounds); if (!Object.op_Implicit((Object)(object)model)) { return false; } Renderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<Renderer>(); bool flag = false; foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && val.enabled && (val is SkinnedMeshRenderer || val is MeshRenderer)) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } return flag; } private void Seize() { //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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (holdingModel || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator)) { return; } model = body.modelLocator.modelTransform; if (Object.op_Implicit((Object)(object)model)) { holdingModel = true; heldScale = model.localScale; heldRotation = model.localRotation; press = 0f; animator = ((Component)model).GetComponent<Animator>(); if (Object.op_Implicit((Object)(object)animator)) { heldAnimatorSpeed = JujutsuFxHitStop.TrueSpeed(body, animator); animator.speed = 0f; } } } private void Update() { if (!closed) { age += Time.deltaTime; Carry(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)NaoyaBuffs.Framed) && body.HasBuff(NaoyaBuffs.Framed)) { marked = true; } else if (marked) { Shatter(); } else if (age >= life) { Close(broken: false); } } } private void LateUpdate() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!holdingModel) { if (!closed) { Seize(); } return; } if (!Object.op_Implicit((Object)(object)model)) { holdingModel = false; animator = null; return; } press = Mathf.MoveTowards(press, closed ? 0f : 1f, Time.deltaTime / 0.12f); float num = JujutsuEase.OutCubic(Mathf.Clamp01(press)); model.rotation = Quaternion.Slerp(model.rotation, Quaternion.LookRotation(-forward, Vector3.up), num); model.localScale = Vector3.Scale(heldScale, new Vector3(Mathf.Lerp(1f, 1.12f, num), Mathf.Lerp(1f, 1.12f, num), Mathf.Lerp(1f, 0.12f, num))); if (closed && press <= 0f) { Release(); ((Behaviour)this).enabled = false; } } private void Carry() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (holdingModel) { return; } Vector3 anchor = Anchor; for (int i = 0; i < panes.Count && i < offsets.Count; i++) { NaoyaPane naoyaPane = panes[i]; if (Object.op_Implicit((Object)(object)naoyaPane) && !naoyaPane.Spent) { ((Component)naoyaPane).transform.position = anchor + offsets[i]; } } } internal void Shatter() { if (!closed) { Close(broken: true); } } private void Close(bool broken) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) closed = true; if (broken) { for (int i = 0; i < panes.Count; i++) { NaoyaPane naoyaPane = panes[i]; if (Object.op_Implicit((Object)(object)naoyaPane) && !naoyaPane.Spent) { naoyaPane.Break(-forward, 0f); } } panes.Clear(); } else { NaoyaPanes.Close(panes, Vector3.up, finished: false); } offsets.Clear(); } private void Release() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (holdingModel) { holdingModel = false; if (Object.op_Implicit((Object)(object)model)) { model.localScale = heldScale; model.localRotation = heldRotation; } if (Object.op_Implicit((Object)(object)animator) && !JujutsuFxHitStop.HandBack(body, animator, heldAnimatorSpeed)) { animator.speed = heldAnimatorSpeed; } animator = null; press = 0f; } } private void OnDisable() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!closed) { NaoyaPanes.Close(panes, Vector3.up, finished: false); offsets.Clear(); } Release(); } } internal static class NaoyaPanes { internal const float DrawSeconds = 0.13f; internal const float BreakSeconds = 0.42f; internal const float FadeSeconds = 0.3f; private const float Gravity = 3.4f; private const int Columns = 3; private const int Rows = 3; private static Texture2D glass; private const float GateSpacing = 3.2f; private const float StaggerSeconds = 0.06f; internal static Texture2D Glass { get { if (!Object.op_Implicit((Object)(object)glass)) { return glass = BuildGlass(); } return glass; } } internal static float Fall => 3.4f; internal static int Across => 3; internal static int Down => 3; private static Texture2D BuildGlass() { return JujutsuFxTextures.Build("texNaoyaGlass", 128, (Func<float, float, Color32>)delegate(float u, float v) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) float num = 0.5f + 0.5f * Mathf.Sin(MathF.PI * 2f * (u + v)); float num2 = Mathf.Sin(MathF.PI * 2f * u * 3f) * Mathf.Sin(MathF.PI * 2f * v * 3f); float num3 = Mathf.Clamp01(0.5f + num * 0.1f + num2 * 0.03f); byte b = (byte)Mathf.RoundToInt(num3 * 255f); byte num4 = (byte)Mathf.RoundToInt(Mathf.Clamp01(Mathf.Pow(num3, 1.35f)) * 255f); return new Color32(num4, num4, num4, b); }); } internal static NaoyaPane Draw(Vector3 centre, Vector3 normal, float halfWidth, float halfHeight, Color colour, float life, int seed, float fill = 1f) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0056: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref normal)).sqrMagnitude < 0.0001f) { normal = Vector3.forward; } ((Vector3)(ref normal)).Normalize(); Mesh ownedMesh = default(Mesh); MeshRenderer val = default(MeshRenderer); GameObject obj = JujutsuFxMesh.Object("NaoyaPane", ref ownedMesh, ref val); obj.transform.position = centre; obj.transform.rotation = Quaternion.LookRotation(normal, (Mathf.Abs(normal.y) > 0.985f) ? Vector3.forward : Vector3.up); Material val2 = (((Renderer)val).sharedMaterial = JujutsuFxMaterials.CreateLineMaterial("matNaoyaPane", colour, 1.6f, Glass)); JujutsuFxMaterials.Claim(obj, val2); NaoyaPane naoyaPane = obj.AddComponent<NaoyaPane>(); naoyaPane.Configure(ownedMesh, val2, colour, halfWidth, halfHeight, life, seed, fill); JujutsuFxBudget.Register(obj, (Kind)3); return naoyaPane; } internal static void Line(List<NaoyaPane> into, CharacterBody body, Vector3 from, Vector3 heading, float distance, int count, Color colour, float life) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Along(into, body, (float arc) => from + heading * arc, (float arc) => heading, distance, count, colour, life); } internal static void Along(List<NaoyaPane> into, CharacterBody body, Func<float, Vector3> at, Func<float, Vector3> along, float distance, int count, Color colour, float life) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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 (into == null || at == null || along == null || count <= 0) { return; } float num = distance / (float)count; float num2 = Mathf.Clamp01(num / 3.2f); float halfWidth = JujutsuFxScale.Of(body, Mathf.Lerp(0.78f, 1.35f, num2)); float halfHeight = JujutsuFxScale.Of(body, Mathf.Lerp(1f, 1.9f, num2)); int num3 = SeedFrom(at(0f)); float fill = Mathf.Clamp(6f / (float)count, 0.35f, 1f); for (int i = 0; i < count; i++) { float arg = num * ((float)i + 0.5f); NaoyaPane naoyaPane = Draw(at(arg), -along(arg), halfWidth, halfHeight, colour, life, num3 + i * 15485863, fill); if (Object.op_Implicit((Object)(object)naoyaPane)) { naoyaPane.Delay((count > 1) ? (0.06f * (float)i / (float)(count - 1)) : 0f); into.Add(naoyaPane); } } } internal static void Case(List<NaoyaPane> into, Vector3 centre, Vector3 heading, float halfWidth, float halfHeight, Color colour, float life) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (into != null) { Vector3 val = Vector3.ProjectOnPlane(heading, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); NaoyaPane naoyaPane = Draw(centre, -val, halfWidth, halfHeight, colour, life, SeedFrom(centre), 0.7f); if (Object.op_Implicit((Object)(object)naoyaPane)) { into.Add(naoyaPane); } } } internal static void Reel(List<NaoyaPane> into, CharacterBody body, Vector3 centre, Vector3 facing, int count, Color colour, float life) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if (into == null || count <= 0) { return; } if (((Vector3)(ref facing)).sqrMagnitude < 0.0001f) { facing = Vector3.forward; } Vector3 val = Vector3.ProjectOnPlane(facing, Vector3.up); facing = ((Vector3)(ref val)).normalized; float num = JujutsuFxScale.Of(body, 2.6f); float num2 = JujutsuFxScale.Of(body, 16f) / (float)count; float halfWidth = JujutsuFxScale.Of(body, 0.42f); float num3 = JujutsuFxScale.Of(body, 0.52f); float num4 = JujutsuFxScale.Of(body, 1.35f); float num5 = JujutsuFxScale.Of(body, 0.5f); val = Vector3.Cross(Vector3.up, facing); Vector3 normalized = ((Vector3)(ref val)).normalized; int num6 = SeedFrom(centre); float fill = Mathf.Clamp(6f / (float)count, 0.3f, 1f); float num7 = ((Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.transform)) ? body.transform.position.y : (centre.y - num3)); for (int i = 0; i < count; i++) { Vector3 val2 = centre + facing * (num + num2 * (float)i) + normalized * ((Mathf.Sin((float)i * 2.4f) * 0.25f + ((i % 2 == 0) ? (-0.7f) : 0.7f)) * num4) + Vector3.up * (Mathf.Sin((float)i * 1.7f + 0.9f) * num5); val2.y = Mathf.Max(val2.y, num7 + num3 * 1.05f); NaoyaPane naoyaPane = Draw(val2, -facing, halfWidth, num3, colour, life, num6 + i * 15485863, fill); if (Object.op_Implicit((Object)(object)naoyaPane)) { naoyaPane.Delay((float)i * 0.005f); into.Add(naoyaPane); } } } internal static NaoyaPane At(List<NaoyaPane> panes, int index) { if (panes == null || index < 0 || index >= panes.Count) { return null; } NaoyaPane naoyaPane = panes[index]; if (!Object.op_Implicit((Object)(object)naoyaPane) || naoyaPane.Spent) { return null; } return naoyaPane; } internal static void Close(List<NaoyaPane> panes, Vector3 through, bool finished) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (panes == null) { return; } for (int i = 0; i < panes.Count; i++) { NaoyaPane naoyaPane = panes[i]; if (Object.op_Implicit((Object)(object)naoyaPane) && !naoyaPane.Spent) { if (finished) { naoyaPane.Break(through, 0f); } else { naoyaPane.Expire(); } } } panes.Clear(); } internal static int SeedFrom(Vector3 origin) { //IL_0000: 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_002f: Unknown result type (might be due to invalid IL or missing references) return (Mathf.RoundToInt(origin.x * 100f) * 73856093) ^ (Mathf.RoundToInt(origin.y * 100f) * 19349663) ^ (Mathf.RoundToInt(origin.z * 100f) * 83492791); } } internal sealed class NaoyaPane : MonoBehaviour { private Mesh mesh; private Material material; private Color colour; private float halfWidth; private float halfHeight; private float border; private float fillWeight = 1f; private float life; private int seed; private float age; private float delay; private float breakAfter = -1f; private Vector3 breakThrough; private float breakForce; private bool breaking; private bool expiring; private float endedAt; private Vector3[] velocities; private Vector3[] axes; private float[] spins; internal bool Spent { get { if (!breaking) { return expiring; } return true; } } internal void Configure(Mesh ownedMesh, Material ownedMaterial, Color baseColour, float width, float height, float standingSeconds, int hash, float fill) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) mesh = ownedMesh; material = ownedMaterial; colour = baseColour; halfWidth = Mathf.Max(0.01f, width); halfHeight = Mathf.Max(0.01f, height); border = Mathf.Min(halfWidth, halfHeight) * 0.16f; fillWeight = Mathf.Clamp01(fill); life = Mathf.Max(0.1f, standingSeconds); seed = hash; Rebuild(null, null); Shade(0f, 4.4f); ((Component)this).transform.localScale = Vector3.zero; } internal void Delay(float seconds) { delay = Mathf.Max(0f, seconds); life += delay; } internal void BreakIn(float after, Vector3 through, float force = 0f) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!Spent) { breakAfter = Mathf.Max(0f, after); breakThrough = through; breakForce = force; } } internal void Break(Vector3 through, float force) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_025a: Unknown result type (might be due to invalid IL or missing references) if (Spent) { return; } breaking = true; endedAt = age; ((Component)this).transform.localScale = Vector3.one; if (((Vector3)(ref through)).sqrMagnitude < 0.0001f) { through = ((Component)this).transform.forward; } ((Vector3)(ref through)).Normalize(); if (force <= 0f) { force = Mathf.Clamp(2.2f + halfWidth * 3.4f, 2.5f, 11f); } Vector3 val = ((Component)this).transform.InverseTransformDirection(through); int num = NaoyaPanes.Across * NaoyaPanes.Down; velocities = (Vector3[])(object)new Vector3[num]; axes = (Vector3[])(object)new Vector3[num]; spins = new float[num]; float num2 = halfWidth / (float)NaoyaPanes.Across; float num3 = halfHeight / (float)NaoyaPanes.Down; Vector3 val2 = default(Vector3); for (int i = 0; i < num; i++) { int num4 = i % NaoyaPanes.Across; int num5 = i / NaoyaPanes.Across; ((Vector3)(ref val2))..ctor(0f - halfWidth + num2 * (float)(2 * num4 + 1), 0f - halfHeight + num3 * (float)(2 * num5 + 1), 0f); if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f) { ((Vector3)(ref val2)).Normalize(); } velocities[i] = val * (force * Mathf.Lerp(0.5f, 1.2f, Fraction(i, 1))) + val2 * (force * 0.45f * Mathf.Lerp(0.35f, 1f, Fraction(i, 2))); Vector3[] array = axes; int num6 = i; Vector3 val3 = new Vector3(Mathf.Lerp(-1f, 1f, Fraction(i, 3)), Mathf.Lerp(-1f, 1f, Fraction(i, 4)), Mathf.Lerp(-1f, 1f, Fraction(i, 5))); array[num6] = ((Vector3)(ref val3)).normalized; spins[i] = Mathf.Lerp(160f, 620f, Fraction(i, 6)); } JujutsuFxDebris.Throw(((Component)this).transform.position, through, colour, halfWidth, (halfWidth > 1f) ? 4 : 2, 0f, 0.45f); JujutsuGlassSfx.PlayShatter(((Component)this).transform.position, halfWidth, 0.3f); } internal void Expire() { if (!Spent) { expiring = true; endedAt = age; } } private void Update() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; if (breaking) { Breaking(); } else if (expiring) { Expiring(); } else if (!(age < delay)) { if (breakAfter >= 0f && age >= delay + 0.13f + breakAfter) { Break(breakThrough, breakForce); } else if (age >= life) { Expire(); } else { Standing(); } } } private void Standing() { //IL_0083: 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) float num = (age - delay) / 0.13f; if (num < 1f) { ((Component)this).transform.localScale = new Vector3(Mathf.Lerp(0.04f, 1f, JujutsuEase.OutQuint(num)), Mathf.Lerp(0.45f, 1f, JujutsuEase.OutBack(num, 0.25f)), 1f); Shade(JujutsuEase.OutQuint(num), Mathf.Lerp(4.4f, 1.6f, num)); } else { ((Component)this).transform.localScale = Vector3.one; Shade(JujutsuEase.FlickerScaled(age * 1.7f, 0.72f, 9f), 1.6f); } } private void Breaking() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = (age - endedAt) / 0.42f; if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float elapsed = num * 0.42f; Vector3 fall = ((Component)this).transform.InverseTransformDirection(Vector3.down) * (0.5f * NaoyaPanes.Fall * elapsed * elapsed); Rebuild((int index) => velocities[index] * elapsed + fall, (int index) => Quaternion.AngleAxis(spins[index] * elapsed, axes[index])); Shade(JujutsuEase.Snap(num, 0.1f), Mathf.Lerp(4.4f, 0.55f, JujutsuEase.OutCubic(num))); } private void Expiring() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) float num = (age - endedAt) / 0.3f; if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.localScale = new Vector3(1f, Mathf.Lerp(1f, 0.86f, JujutsuEase.InQuad(num)), 1f); Shade(1f - JujutsuEase.InQuad(num), 0.55f); } private void Rebuild(Func<int, Vector3> drift, Func<int, Quaternion> tumble) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) JujutsuFxMesh.Pane(mesh, halfWidth, halfHeight, border, colour, Fill(colour, 0.2f * fillWeight), NaoyaPanes.Across, NaoyaPanes.Down, drift, tumble); } private static Color Fill(Color source, float weight) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return new Color(source.r * weight, source.g * weight, source.b * weight, source.a * weight); } private void Shade(float alpha, float glow) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) JujutsuFxMaterials.SetEnvelope(material, colour, alpha, glow); } private float Fraction(int cell, int salt) { int num = seed * 374761393 + cell * 668265263 + salt * 1442695040; int num2 = (num ^ (num >> 13)) * 1274126177; return (float)((num2 ^ (num2 >> 16)) & 0xFFFFFF) / 16777215f; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } } } namespace GojoSatoruMod.States { public sealed class NaoyaCorridorState : BaseSkillState, IPosedState { internal const float Length = 30f; internal const float Corridor = 3f; private const int Frames = 9; internal const float RunSpeed = 60f; internal const float BreakCoefficient = 8f; internal const float SealSeconds = 2f; internal const float FullFilmSealSeconds = 2.6f; internal const int TracedFrames = 8; private const float LaySeconds = 0.34f; private const float LayFraction = 0.55f; private const float RunCeiling = 1.6f; private const float Recover = 0.12f; private const int StallTicks = 3; private const float ExitSpeedShare = 1f; private const float StrideRate = 15f; private const float LookAhead = 3f; private const float Window = 16f; private Vector3 aim; private Vector3 flat; private Vector3 origin; private bool fromWire; private NaoyaCorridorPath path; private float wind; private bool laid; private bool running; private bool finished; private float runStartedAt; private float finishedAt; private float progress; private int stalled; private bool fallsIgnored; private bool gravityHeld; private float stride; private float seconds = 2f; private readonly List<NaoyaPane> panes = new List<NaoyaPane>(9); private int crossed; private readonly List<CharacterBody> broken = new List<CharacterBody>(8); private readonly List<CharacterBody> found = new List<CharacterBody>(16); private readonly List<float> arcs = new List<float>(16); private int spent; private int sealed_; bool IPosedState.DrivesPose { get { if (running) { return !finished; } return false; } } GojoCpuPose IPosedState.Pose => (GojoCpuPose)3; float IPosedState.PosePhase => stride; float IPosedState.PoseBob => 0f; float IPosedState.PosePitch => 0f; bool IPosedState.HoldsSlashPose => false; int IPosedState.PosePriority => 20; public override void OnEnter() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); if (!fromWire) { aim = Bearing(); origin = ((EntityState)this).characterBody.corePosition; } flat = Flatten(aim); path = NaoyaCorridorPath.Build(origin, aim, 30f); wind = 0.34f / Mathf.Max(0.1f, ((BaseState)this).attackSpeedStat); ((EntityState)this).characterBody.SetAimTimer(wind + 1.6f + 0.12f); Face(); GojoModelAnimator val = GojoModelAnimator.Find(((EntityState)this).characterBody); if (Object.op_Implicit((Object)(object)val)) { val.ClearAttackPose(); val.TriggerPunch(true, wind, 0, 0.55f); } JujutsuSfxAssets.PlayLightWhoosh(((EntityState)this).characterBody.corePosition, 0.9f); } private Vector3 Bearing() { //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_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_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_0024: 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_0088: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; if (((Vector3)(ref direction)).sqrMagnitude > 0.0001f) { ((Vector3)(ref direction)).Normalize(); if (direction.y < 0f) { Vector2 val = new Vector2(direction.x, direction.z); if (((Vector2)(ref val)).sqrMagnitude < 0.04f) { return Flatten(((EntityState)this).characterBody.transform.forward); } } return direction; } Vector3 forward = ((EntityState)this).characterBody.transform.forward; if (!(((Vector3)(ref forward)).sqrMagnitude > 0.0001f)) { return Vector3.forward; } return ((Vector3)(ref forward)).normalized; } private static Vector3 Flatten(Vector3 line) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) Vector3 val = Vector3.ProjectOnPlane(line, Vector3.up); if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) { return Vector3.forward; } return ((Vector3)(ref val)).normalized; } private void Face() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = flat; } } public override void OnSerialize(NetworkWriter writer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnSerialize(writer); writer.Write(aim); writer.Write(origin); } public override void OnDeserialize(NetworkReader reader) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnDeserialize(reader); aim = reader.ReadVector3(); origin = reader.ReadVector3(); fromWire = true; } public override void Update() { ((EntityState)this).Update(); if (running && !finished) { stride = Mathf.Repeat(stride + Time.deltaTime * 15f, MathF.PI * 200f); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (finished) { Tail(); } else if (!running) { GojoStateUtils.SlowMovementDuringAttack(((EntityState)this).characterMotor, ((EntityState)this).isAuthority, 0.2f); if (!laid && ((EntityState)this).fixedAge >= wind * 0.55f) { Lay(); } if (laid && ((EntityState)this).fixedAge >= wind) { Begin(); } } else { Run(); } } private void Lay() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) laid = true; Face(); NaoyaFilm naoyaFilm = NaoyaFilm.Of(((EntityState)this).characterBody); seconds = ((Object.op_Implicit((Object)(object)naoyaFilm) && naoyaFilm.Full) ? 2.6f : 2f); NaoyaPanes.Along(panes, ((EntityState)this).characterBody, path.PointAt, path.TangentAt, path.Span, 9, NaoyaLanguage.Colour, seconds); sealed_ = Inside(found, 0f, path.Span); for (int i = 0; i < sealed_; i++) { CharacterBody val = found[i]; if (Object.op_Implicit((Object)(object)val)) { NaoyaFilm.Catch(val, seconds); NaoyaHold.Pin(val, seconds, ((EntityState)this).characterBody); if (i < 16) { NaoyaGlassCase.Stand(val, flat, seconds); } } } if (((EntityState)this).isAuthority) { NaoyaFilm.Of(((EntityState)this).characterBody)?.Trace(8); Plugin.Log.LogInfo((object)("Naoya's corridor is " + StatText.Metres(path.Span) + " long and " + StatText.Metres(3f) + " wide, laid " + $"{Mathf.RoundToInt(path.End.y - origin.y)}m higher than " + $"it started; it sealed {sealed_} " + $"body/bodies for {seconds:0.##}s and traced " + $"{8} frames."), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\States\\NaoyaCorridorState.cs"); } float num = NaoyaFx.Reach(((EntityState)this).characterBody, 3f); Vector3 val2 = path.PointAt(3f); Vector3 val3 = path.TangentAt(3f); JujutsuImpact.Strike(val2, val3, NaoyaLanguage.Colour, num, JujutsuFxScale.Weight(1f), false, true); JujutsuMotes.Burst(val2, val3, NaoyaLanguage.Colour, num * 0.8f, (JujutsuMoteKind)2, 12); JujutsuSfxAssets.PlayHeavyWhoosh(origin, 1f); } private void Begin() { //IL_006d: 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) running = true; runStartedAt = ((EntityState)this).fixedAge; progress = 0f; JujutsuCloseDash.IgnoreFalls(((EntityState)this).characterBody, true, false); fallsIgnored = true; if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).characterMotor.useGravity) { ((EntityState)this).characterMotor.useGravity = false; gravityHeld = true; } JujutsuSfxAssets.PlayHeavyWhoosh(((EntityState)this).characterBody.corePosition, 0.85f); NaoyaFx.Afterimage(((EntityState)this).characterBody, path.TangentAt(0f)); } private void Run() { //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_001a: 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_00a9: Unknown result type (might be due to invalid IL or missing references) Vector3 corePosition = ((EntityState)this).characterBody.corePosition; float num = progress; progress = path.Advance(corePosition, progress, 16f); Cross(progress); if (Mathf.Repeat(((EntityState)this).fixedAge, 0.07f) < Time.fixedDeltaTime) { NaoyaFx.Afterimage(((EntityState)this).characterBody, path.TangentAt(progress)); } if (!((EntityState)this).isAuthority || !Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge - runStartedAt >= 1.6f) { Finish(ranOut: false); } return; } Drive(corePosition); if (((EntityState)this).fixedAge - runStartedAt > Time.fixedDeltaTime * 2f) { stalled = ((progress - num < 60f * Time.fixedDeltaTime * 0.25f) ? (stalled + 1) : 0); } if (progress >= path.Span - 0.05f) { Finish(ranOut: true); } else if (stalled >= 3 || ((EntityState)this).fixedAge - runStartedAt >= 1.6f) { Finish(ranOut: false); } } private void Drive(Vector3 here) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).characterMotor.moveDirection = Vector3.zero; Vector3 val = Ahead(progress + 3f) - here; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = path.TangentAt(progress); } KinematicCharacterMotor motor = ((BaseCharacterController)((EntityState)this).characterMotor).Motor; if (Object.op_Implicit((Object)(object)motor)) { motor.ForceUnground(0.1f); } ((EntityState)this).characterMotor.velocity = ((Vector3)(ref val)).normalized * 60f; } private Vector3 Ahead(float arc) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) float span = path.Span; if (arc <= span) { return path.PointAt(arc); } return path.PointAt(span) + path.TangentAt(span) * (arc - span); } private void Cross(float along) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) float num = path.Span / 9f; while (crossed < panes.Count && ((float)crossed + 0.5f) * num <= along) { NaoyaPane naoyaPane = NaoyaPanes.At(panes, crossed); float arc = ((float)crossed + 0.5f) * num; crossed++; if (Object.op_Implicit((Object)(object)naoyaPane)) { naoyaPane.Break(path.TangentAt(arc), 0f); } } int num2 = Inside(found, 0f, along); int num3 = 0; for (int i = 0; i < num2; i++) { CharacterBody val = found[i]; if (Object.op_Implicit((Object)(object)val) && !broken.Contains(val)) { broken.Add(val); num3++; Shatter(val, arcs[i]); } } if (num3 > 0 && ((EntityState)this).isAuthority) { spent += num3; NaoyaFilm.ReportHit(((EntityState)this).characterBody); CursedEnergyController component = ((Component)((EntityState)this).characterBody).GetComponent<CursedEnergyController>(); if (component != null) { component.RestoreFromMelee(0.5f); } } } private void Shatter(CharacterBody victim, float arc) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0114: 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_0123: 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) Vector3 corePosition = victim.corePosition; Vector3 val = path.TangentAt(arc); NaoyaGlassCase.Break(victim); JujutsuImpact.Strike(corePosition, val, NaoyaLanguage.Colour, NaoyaFx.Reach(((EntityState)this).characterBody, 2.1f), JujutsuFxScale.Weight(8f), false, true); JujutsuMotes.Burst(corePosition, val, NaoyaLanguage.Colour, NaoyaFx.Reach(((EntityState)this).characterBody, 1.5f), (JujutsuMoteKind)2, 8); JujutsuGlassSfx.PlayShatter(corePosition, 1.8000001f, 0.3f); if (!NetworkServer.active) { return; } HealthComponent healthComponent = victim.healthComponent; if (!Object.op_Implicit((Object)(object)healthComponent)) { return; } int num; if (Object.op_Implicit((Object)(object)NaoyaBuffs.Framed)) { num = (victim.HasBuff(NaoyaBuffs.Framed) ? 1 : 0); if (num != 0) { goto IL_00c3; } } else { num = 0; } if (Object.op_Implicit((Object)(object)NaoyaBuffs.Cracked) && victim.HasBuff(NaoyaBuffs.Cracked)) { goto IL_00c3; } float num2 = 1f; goto IL_00c8; IL_00c3: num2 = 1.4f; goto IL_00c8; IL_00c8: float num3 = num2; NaoyaFilm.ShatterFrame(victim); NaoyaHold.LetGo(victim); GojoDamageUtility.ApplyDamage(((EntityState)this).gameObject, healthComponent, ((BaseState)this).damageStat * 8f * num3, val * 2400f + Vector3.up * 700f, ((BaseState)this).RollCrit(), 1f, DamageTypeCombo.GenericUtility | DamageTypeCombo.op_Implicit((DamageType)1024), (DamageColorIndex)0, (Color?)NaoyaLanguage.Colour, (float?)null); if (num != 0) { for (int i = 0; i < 3; i++) { DotController.InflictDot(((Component)victim).gameObject, ((EntityState)this).gameObject, (HurtBox)null, (DotIndex)0, 5f, 1f, (uint?)null); } } } private int Inside(List<CharacterBody> into, float from, float to) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0088: 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) into.Clear(); arcs.Clear(); ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList; if (readOnlyInstancesList == null) { return 0; } TeamIndex team = ((BaseState)this).GetTeam(); for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val.teamComponent == (Object)null) && val.teamComponent.teamIndex != team && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive) { float num = 3f + val.radius; if (path.Anywhere(val.corePosition, num) && !(path.Closest(val.corePosition, from, to, out var at) > num)) { into.Add(val); arcs.Add(at); } } } return into.Count; } private void Finish(bool ranOut) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (ranOut) { Cross(path.Span); } finished = true; finishedAt = ((EntityState)this).fixedAge; Release(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { Vector3 velocity = ((EntityState)this).characterMotor.velocity; velocity.x *= 1f; velocity.z *= 1f; velocity.y = Mathf.Min(0f, velocity.y); ((EntityState)this).characterMotor.velocity = velocity; ((EntityState)this).characterMotor.disableAirControlUntilCollision = true; } JujutsuSfxAssets.PlayHeavyWhoosh(((EntityState)this).characterBody.corePosition, 0.7f); NaoyaFx.Afterimage(((EntityState)this).characterBody, path.TangentAt(progress)); if (((EntityState)this).isAuthority) { Plugin.Log.LogInfo((object)(ranOut ? ($"Naoya ran his corridor out — {progress:0.#}m of " + $"{path.Span:0.#}m — and broke {spent} of the {sealed_} " + "frame(s) it laid for " + StatText.Percent(8f) + " each.") : ($"Naoya's corridor was stopped after {progress:0.#}m " + $"of {path.Span:0.#}m; {spent} of {sealed_} frame(s) " + "were broken and the rest stand where they were laid.")), "C:\\Users\\user\\Documents\\risk of rain 2\\src\\Naoya\\States\\NaoyaCorridorState.cs"); } } private void Release() { if (gravityHeld) { gravityHeld = false; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.useGravity = true; } } } private void Tail() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } if (((EntityState)this).fixedAge >= finishedAt + 0.12f && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c3: Unknown result type (might be due to invalid IL or missing references) if (running && Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && path != null) { Cross(path.Advance(((EntityState)this).characterBody.corePosition, progress, path.Span)); } NaoyaPanes.Close(panes, flat, finished: false); if (!finished && running && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).isAuthority) { Vector3 velocity = ((EntityState)this).characterMotor.velocity; velocity.x = 0f; velocity.z = 0f; velocity.y = Mathf.Min(0f, velocity.y); ((EntityState)this).characterMotor.velocity = velocity; } Release(); if (fallsIgnored) { JujutsuCloseDash.IgnoreFalls(((EntityState)this).characterBody, false, true); fallsIgnored = false; } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public sealed class NaoyaCurseFlightState : GenericCharacterMain { private bool pressedJumpWhileHoldingSprint; private bool countersRaised; private float restoreAirControl; public override void OnEnter() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((GenericCharacterMain)this).OnEnter(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { CharacterGravityParameters gravityParameters = ((EntityState)this).characterMotor.gravityParameters; gravityParameters.channeledAntiGravityGranterCount++; ((EntityState)this).characterMotor.gravityParameters = gravityParameters; CharacterFlightParameters flightParameters = ((EntityState)this).characterMotor.flightParameters; flightParameters.channeledFlightGranterCount++; ((EntityState)this).characterMotor.flightParameters = flightParameters; countersRaised = true; restoreAirControl = ((EntityState)this).characterMotor.airControl; ((EntityState)this).characterMotor.airControl = 1f; if (Object.op_Implicit((Object)(object)((BaseCharacterController)((EntityState)this).characterMotor).Motor)) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); } } if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator)) { ((EntityState)this).modelLocator.normalizeToFloor = false; } } public override void OnExit() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && countersRaised) { CharacterGravityParameters gravityParameters = ((EntityState)this).characterMotor.gravityParameters; gravityParameters.channeledAntiGravityGranterCount--; ((EntityState)this).characterMotor.gravityParameters = gravityParameters; CharacterFlightParameters flightParameters = ((EntityState)this).characterMotor.flightParameters; flightParameters.channeledFlightGranterCount--; ((EntityState)this).characterMotor.flightParameters = flightParameters; ((EntityState)this).characterMotor.airControl = restoreAirControl; countersRaised = false; } ((GenericCharacterMain)this).OnExit(); } public override void GatherInputs() { ((GenericCharacterMain)this).GatherInputs(); if (!((BaseCharacterMain)this).hasInputBank) { return; } if (((EntityState)this).inputBank.jump.down) { if (((EntityState)this).inputBank.sprint.down) { pressedJumpWhileHoldingSprint = true; } base.moveVector.y = 1f; } else if (!((EntityState)this).inputBank.sprint.down) { pressedJumpWhileHoldingSprint = false; } if (((EntityState)this).inputBank.sprint.down && !pressedJumpWhileHoldingSprint) { base.moveVector.y = -1f; } if (((Vector3)(ref base.moveVector)).sqrMagnitude > 1f) { ((Vector3)(ref base.moveVector)).Normalize(); } } public override void ProcessJump() { } } public sealed class NaoyaDomainState : BaseSkillState, IPosedState { internal const float CastDuration = 2.5f; private Vector3 lockedFacing; private bool activated; private bool gravitySuspended; private GojoFaceCamera faceCamera; bool IPosedState.DrivesPose => true; GojoCpuPose IPosedState.Pose => (GojoCpuPose)17; float IPosedState.PosePhase => AnimationPhase; float IPosedState.PoseBob => 0.06f; float IPosedState.PosePitch => -8f; bool IPosedState.HoldsSlashPose => false; int IPosedState.PosePriority => 30; internal float AnimationPhase => Mathf.Clamp01(((EntityState)this).fixedAge / 2.5f); public override void OnEnter() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(3f); Vector3 val; Vector3 normalized; if (!Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { val = Vector3.ProjectOnPlane(((EntityState)this).characterBody.transform.forward, Vector3.up); normalized = ((Vector3)(ref val)).normalized; } else { val = Vector3.ProjectOnPlane(((EntityState)this).characterDirection.forward, Vector3.up); normalized = ((Vector3)(ref val)).normalized; } lockedFacing = normalized; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && ((EntityState)this).characterMotor.useGravity) { gravitySuspended = true; ((EntityState)this).characterMotor.useGravity = false; } LockMovement(); if (((EntityState)this).isAuthority) { faceCamera = GojoFaceCamera.Push(((EntityState)this).characterBody); } RootedArmorController obj = RootedArmorController.Find(((EntityState)this).characterBody); if (obj != null) { obj.Push(); } JujutsuSfxAssets.PlayHeavyWhoosh(((EntityState)this).characterBody.corePosition, 1f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); LockMovement(); if (!activated && ((EntityState)this).fixedAge >= 2.5f) { activated = true; Open(); } if (((EntityState)this).fixedAge >= 2.5f && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void Open() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Vector3 corePosition = ((EntityState)this).characterBody.corePosition; ((Component)((EntityState)this).characterBody).GetComponent<NaoyaDomainField>()?.Activate(corePosition, ((BaseState)this).damageStat); DomainBarrierVisual.SpawnSeal(corePosition, NaoyaDomainField.Colour, 28f, (GojoTechniqueStyle)4); JujutsuSfxAssets.PlayMeleeHeavy(corePosition); } private void LockMovement() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; ((EntityState)this).characterMotor.rootMotion = Vector3.zero; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) && ((Vector3)(ref lockedFacing)).sqrMagnitude > 0.01f) { ((EntityState)this).characterDirection.moveVector = lockedFacing; ((EntityState)this).characterDirection.forward = lockedFacing; } } } public override void OnExit() { if (gravitySuspended) { gravitySuspended = false; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.useGravity = true; } } if ((Object)(object)faceCamera != (Object)null) { faceCamera.Release(); faceCamera = null; } RootedArmorController obj = RootedArmorController.Find(((EntityState)this).characterBody); if (obj != null) { obj.Pop(); } if (!activated && ((EntityState)this).isAuthority) { CursedEnergySkillDef.Refund(((BaseSkillState)this).activatorSkillSlot); } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public sealed class NaoyaBleedoutState : BaseSkillState { internal const float Coefficient = 6.5f; internal const float Reach = 42f; internal const float Corridor = 1.9f; internal const int Stacks = 3; internal const float BleedSeconds = 5f; internal const float HemorrhageSeconds = 7f; private const float Duration = 0.66f; private const float Contact = 0.44f; private const float Travel = 1.1f; private const float Ripple = 0.19f; private const int Frames = 10; private const string Wound = "naoya-bleedout"; private float duration; private Vector3 origin; private Vector3 heading; private bool struck; private bool fromWire; private float stabbedAt; private int broken; private readonly List<NaoyaPane> panes = new List<NaoyaPane>(10); internal static void Initialize() { JujutsuHitSync.Register("naoya-bleedout", 50f, (Action<CharacterBody, Vector3, Vector3, float, bool>)Bleed); } public override void OnEnter() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unk