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 Whitebeard v1.0.1
plugins/WhitebeardMod.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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.Commando; using EntityStates.Commando.CommandoWeapon; using HG.BlendableTypes; using KinematicCharacterController; using On.EntityStates; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.SurvivorMannequins; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using WhitebeardMod; using WhitebeardMod.Modules; using WhitebeardMod.Modules.BaseStates; using WhitebeardMod.Modules.Characters; using WhitebeardMod.Survivors.Whitebeard; using WhitebeardMod.Survivors.Whitebeard.Components; using WhitebeardMod.Survivors.Whitebeard.SkillStates; using WhitebeardVFX.Runtime; [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("WhitebeardMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WhitebeardMod")] [assembly: AssemblyTitle("WhitebeardMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] internal sealed class WBSfx : MonoBehaviour { internal sealed class Voice { internal short[] samples; internal int offset; internal Transform follow; internal Vector3 position; internal float gain; internal float range; internal bool stopped; } [StructLayout(LayoutKind.Sequential, Pack = 2)] private struct Format { public ushort tag; public ushort channels; public uint rate; public uint bytesPerSecond; public ushort alignment; public ushort bits; public ushort extra; } private struct Header { public IntPtr data; public uint bytes; public uint recorded; public UIntPtr user; public uint flags; public uint loops; public IntPtr next; public IntPtr reserved; } private static WBSfx mixer; private readonly Dictionary<string, short[]> clips = new Dictionary<string, short[]>(); private readonly List<Voice> voices = new List<Voice>(); private const int Frames = 1024; private readonly float[] mix = new float[2048]; private readonly short[] pcm = new short[2048]; private readonly List<IntPtr> headers = new List<IntPtr>(); private IntPtr device; private bool unavailable; private int next; private static readonly int HeaderSize = Marshal.SizeOf(typeof(Header)); [DllImport("winmm.dll")] private static extern uint waveOutOpen(out IntPtr device, uint id, ref Format format, IntPtr callback, IntPtr context, uint flags); [DllImport("winmm.dll")] private static extern uint waveOutPrepareHeader(IntPtr device, IntPtr header, int size); [DllImport("winmm.dll")] private static extern uint waveOutUnprepareHeader(IntPtr device, IntPtr header, int size); [DllImport("winmm.dll")] private static extern uint waveOutWrite(IntPtr device, IntPtr header, int size); [DllImport("winmm.dll")] private static extern uint waveOutReset(IntPtr device); [DllImport("winmm.dll")] private static extern uint waveOutClose(IntPtr device); private void Awake() { mixer = this; } internal static Voice Play(string name, Vector3 position, Transform follow = null, float gain = 0.8f, float range = 90f) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if ((!NetworkClient.active && range > 0f) || !Object.op_Implicit((Object)(object)mixer) || mixer.unavailable || mixer.voices.Count >= 48) { return null; } if ((int)Application.platform != 2 && (int)Application.platform != 7) { return null; } if (mixer.device == IntPtr.Zero && !mixer.Open()) { return null; } if (!mixer.clips.TryGetValue(name, out var value)) { using (Stream stream = typeof(WBSfx).Assembly.GetManifestResourceStream("WBSFX." + name)) { if (stream == null) { return null; } stream.Position = 40L; using BinaryReader binaryReader = new BinaryReader(stream); byte[] array = binaryReader.ReadBytes(binaryReader.ReadInt32()); value = new short[array.Length / 2]; Buffer.BlockCopy(array, 0, value, 0, array.Length); } mixer.clips.Add(name, value); } Voice voice = new Voice { samples = value, position = position, follow = follow, gain = gain, range = range }; mixer.voices.Add(voice); return voice; } private bool Open() { Format format = new Format { tag = 1, channels = 2, rate = 48000u, bytesPerSecond = 192000u, alignment = 4, bits = 16 }; uint num = waveOutOpen(out device, uint.MaxValue, ref format, IntPtr.Zero, IntPtr.Zero, 0u); if (num == 0) { for (int i = 0; i < 4; i++) { Header structure = new Header { data = Marshal.AllocHGlobal(4096), bytes = 4096u }; IntPtr intPtr = Marshal.AllocHGlobal(HeaderSize); Marshal.StructureToPtr(structure, intPtr, fDeleteOld: false); num = waveOutPrepareHeader(device, intPtr, HeaderSize); if (num != 0) { Marshal.FreeHGlobal(structure.data); Marshal.FreeHGlobal(intPtr); break; } headers.Add(intPtr); } } if (num == 0) { return true; } Fail(num); return false; } private void LateUpdate() { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) if (device == IntPtr.Zero) { return; } if (!NetworkClient.active) { voices.RemoveAll((Voice voice2) => voice2.range > 0f); } Camera val = Camera.main; if (CameraRigController.readOnlyInstancesList.Count > 0) { val = CameraRigController.readOnlyInstancesList[0].sceneCam; } float num = Setting("volume_master") * Setting("volume_sfx") * WhitebeardPlugin.WhitebeardVolume.Value / 100f; for (int num2 = 0; num2 < headers.Count; num2++) { if (voices.Count <= 0) { break; } IntPtr intPtr = headers[next]; Header header = Marshal.PtrToStructure<Header>(intPtr); if ((header.flags & 0x10) != 0) { break; } Array.Clear(mix, 0, mix.Length); for (int num3 = voices.Count - 1; num3 >= 0; num3--) { Voice voice = voices[num3]; if (voice.stopped) { voices.RemoveAt(num3); continue; } if (Object.op_Implicit((Object)(object)voice.follow)) { voice.position = voice.follow.position; } float num4 = voice.gain * num; float num5 = 0f; if (voice.range > 0f) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Vector3 val2 = voice.position - ((Component)val).transform.position; num4 *= Mathf.Clamp01(1f - ((Vector3)(ref val2)).magnitude / voice.range); num5 = Vector3.Dot(((Component)val).transform.right, ((Vector3)(ref val2)).normalized) * 0.65f; } float num6 = num4 * Mathf.Sqrt((1f - num5) * 0.5f); float num7 = num4 * Mathf.Sqrt((1f + num5) * 0.5f); int num8 = Math.Min(1024, voice.samples.Length - voice.offset); for (int num9 = 0; num9 < num8; num9++) { float num10 = voice.samples[voice.offset++]; mix[2 * num9] += num10 * num6; mix[2 * num9 + 1] += num10 * num7; } if (voice.offset == voice.samples.Length) { voices.RemoveAt(num3); } } for (int num11 = 0; num11 < pcm.Length; num11++) { pcm[num11] = (short)Mathf.Clamp(mix[num11], -32768f, 32767f); } Marshal.Copy(pcm, 0, header.data, pcm.Length); uint num12 = waveOutWrite(device, intPtr, HeaderSize); if (num12 != 0) { Fail(num12); break; } next = (next + 1) % headers.Count; } } private static float Setting(string name) { Console instance = Console.instance; BaseConVar val = (Object.op_Implicit((Object)(object)instance) ? instance.FindConVar(name) : null); if (val == null || !float.TryParse(val.GetString(), out var result)) { return 1f; } return Mathf.Clamp01(result / 100f); } private void Fail(uint status) { Debug.LogWarning((object)("[Whitebeard] Windows audio output failed (" + status + ").")); unavailable = true; Close(); } private void Close() { if (device == IntPtr.Zero) { return; } waveOutReset(device); foreach (IntPtr header in headers) { waveOutUnprepareHeader(device, header, HeaderSize); Marshal.FreeHGlobal(Marshal.PtrToStructure<Header>(header).data); Marshal.FreeHGlobal(header); } waveOutClose(device); device = IntPtr.Zero; headers.Clear(); voices.Clear(); next = 0; } private void OnDestroy() { Close(); } } namespace WhitebeardVFX.Runtime { [DisallowMultipleComponent] public sealed class WBGuraBranches : MonoBehaviour { [Tooltip("Charge comes from GuraReleaseLayers on the same object.")] public Material surfaceMaterial; [Tooltip("Charge comes from GuraReleaseLayers on the same object.")] public Material crackMaterial; public Vector4 tierWidths = new Vector4(12f, 17f, 23f, 30f); [Min(0.1f)] public float sizeMultiplier = 1f; [Range(0.2f, 1.2f)] public float verticalRatio = 0.72f; [Min(0f)] public float depth = 3f; [Min(0.01f)] public float crackWidth = 0.1f; [Range(0f, 0.3f)] public float faceTint = 0.035f; [Range(0f, 0.3f)] public float faceShade = 0.045f; public int seed = 17; private GameObject root; private Mesh mesh; private MeshRenderer surface; private MeshRenderer original; private bool originalEnabled; private bool ownsOriginal; private readonly List<LineRenderer> lines = new List<LineRenderer>(); private MaterialPropertyBlock block; private int cachedTier = -1; private int cachedSeed; private int used; private float cachedSize; private float cachedVertical; private float cachedDepth; private float cachedWidth; private float lastTime = -1f; private Vector4 cachedWidths; private const int Steps = 10; private static readonly float[] Angles = new float[11] { 4f, 78f, 151f, 221f, 297f, 39f, 185f, 333f, 112f, 257f, 58f }; public bool Ready { get { if (Object.op_Implicit((Object)(object)surfaceMaterial)) { return Object.op_Implicit((Object)(object)crackMaterial); } return false; } } private float Noise(int n) { int num = n + seed * 7919; int num2 = (num ^ (num >>> 16)) * 2146121005; int num3 = (num2 ^ (num2 >>> 15)) * -2073254261; return (float)(uint)((num3 ^ (num3 >>> 16)) & 0xFFFFFF) / 16777215f; } public void StopPreview() { Release(); } private void OnDisable() { Release(); } private void OnDestroy() { Release(); } private static void Dispose(Object obj) { if (Object.op_Implicit(obj)) { if (Application.isPlaying) { Object.Destroy(obj); } else { Object.DestroyImmediate(obj); } } } private void Release() { if (ownsOriginal && Object.op_Implicit((Object)(object)original)) { ((Renderer)original).enabled = originalEnabled; } ownsOriginal = false; Dispose((Object)(object)root); Dispose((Object)(object)mesh); root = null; mesh = null; surface = null; lines.Clear(); cachedTier = -1; lastTime = -1f; } private void Build() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)root)) { original = ((Component)this).GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)original)) { originalEnabled = ((Renderer)original).enabled; ownsOriginal = true; ((Renderer)original).enabled = false; } root = new GameObject("Gura Branches (generated)"); ((Object)root).hideFlags = (HideFlags)61; root.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); mesh = new Mesh { name = "Gura Broken Air Surface", hideFlags = (HideFlags)61 }; root.AddComponent<MeshFilter>().sharedMesh = mesh; surface = root.AddComponent<MeshRenderer>(); ((Renderer)surface).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)surface).receiveShadows = false; block = new MaterialPropertyBlock(); } } private void AddLine(Vector3[] points, float width) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown LineRenderer val2; if (used == lines.Count) { GameObject val = new GameObject("Crack " + used) { hideFlags = (HideFlags)61 }; val.transform.SetParent(root.transform, false); val2 = val.AddComponent<LineRenderer>(); lines.Add(val2); val2.useWorldSpace = false; val2.alignment = (LineAlignment)0; val2.textureMode = (LineTextureMode)0; val2.numCornerVertices = 0; val2.numCapVertices = 0; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; LineRenderer obj = val2; Color startColor = (val2.endColor = Color.white); obj.startColor = startColor; } else { val2 = lines[used]; } used++; ((Renderer)val2).enabled = true; ((Renderer)val2).sharedMaterial = crackMaterial; val2.positionCount = points.Length; val2.SetPositions(points); val2.widthMultiplier = width; val2.widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 0.8f), new Keyframe(0.22f, 1f), new Keyframe(0.75f, 0.55f), new Keyframe(1f, 0.025f) }); } private void Rebuild(int tier) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) int num = 5 + tier * 2; float num2 = Mathf.Max(1f, ((Vector4)(ref tierWidths))[tier]) * Mathf.Max(0.1f, sizeMultiplier) * 0.5f; Vector3[][] array = new Vector3[num][]; float[] angles = new float[num]; int[] array2 = new int[num]; used = 0; Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < num; i++) { float num3 = (Angles[i] + (Noise(i * 31) - 0.5f) * 8f) * (MathF.PI / 180f); angles[i] = num3; array2[i] = i; float num4 = num2 * (0.65f + 0.35f * Noise(i * 31 + 1)); ((Vector3)(ref val))..ctor(Mathf.Cos(num3), Mathf.Sin(num3) * verticalRatio, 0f); ((Vector3)(ref val2))..ctor(0f - Mathf.Sin(num3), Mathf.Cos(num3) * verticalRatio, 0f); Vector3[] array3 = (Vector3[])(object)new Vector3[11]; for (int j = 1; j <= 10; j++) { float num5 = (float)j / 10f; float num6 = (Noise(i * 101 + j * 7) - 0.5f) * num4 * 0.13f * Mathf.Min(1f, num5 * 4f); array3[j] = val * (num4 * num5) + val2 * num6; } array[i] = array3; AddLine(array3, crackWidth * (0.7f + 0.6f * Noise(i + 400)) * (1f + (float)tier * 0.12f)); int num7 = 1 + tier; for (int k = 0; k < num7; k++) { int num8 = 3 + (i + k * 2) % 5; float num9 = (((i + k) % 2 == 0) ? 1 : (-1)); float num10 = num4 * (0.14f + 0.15f * Noise(i * 53 + k + 600)); Vector3 val3 = array3[num8]; Vector3 val4 = val + val2 * num9 * (0.6f + Noise(i + k + 801)); Vector3 normalized = ((Vector3)(ref val4)).normalized; float num11 = num9 * depth * (0.3f + 0.7f * Noise(i * 19 + k + 901)) * (0.65f + (float)tier * 0.18f); Vector3[] array4 = (Vector3[])(object)new Vector3[5] { val3, default(Vector3), default(Vector3), default(Vector3), default(Vector3) }; for (int l = 1; l < 5; l++) { float num12 = (float)l / 4f; array4[l] = val3 + normalized * (num10 * num12) + Vector3.forward * (num11 * num12) + val2 * ((Noise(i * 87 + k * 13 + l + 1000) - 0.5f) * num10 * 0.22f); } AddLine(array4, crackWidth * (0.25f + 0.16f * Noise(i + k + 1100))); } } for (int m = used; m < lines.Count; m++) { ((Renderer)lines[m]).enabled = false; } Array.Sort(array2, (int a, int b) => angles[a].CompareTo(angles[b])); List<Vector3> list = new List<Vector3>(); List<Color> list2 = new List<Color>(); List<Vector2> list3 = new List<Vector2>(); List<int> list4 = new List<int>(); Color item = default(Color); for (int num13 = 0; num13 < num; num13++) { int num14 = array2[num13]; int num15 = array2[(num13 + 1) % num]; ((Color)(ref item))..ctor(Noise(num14 + 1200), Noise(num14 + 1300), Noise(num14 + 1400), 1f); int count = list.Count; list.Add(Vector3.zero); list2.Add(item); list3.Add(Vector2.zero); for (int num16 = 1; num16 <= 10; num16++) { list.Add(array[num14][num16]); list2.Add(item); list3.Add(new Vector2((float)num16 / 10f, 0f)); } for (int num17 = 10; num17 >= 1; num17--) { list.Add(array[num15][num17]); list2.Add(item); list3.Add(new Vector2((float)num17 / 10f, 1f)); } Triangulate(list, count, 21, list4); } mesh.Clear(); mesh.SetVertices(list); mesh.SetColors(list2); mesh.SetUVs(0, list3); mesh.SetTriangles(list4, 0); mesh.RecalculateBounds(); cachedTier = tier; cachedSeed = seed; cachedSize = sizeMultiplier; cachedVertical = verticalRatio; cachedDepth = depth; cachedWidth = crackWidth; cachedWidths = tierWidths; } private static float Cross(Vector3 a, Vector3 b, Vector3 c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); } private static void Triangulate(List<Vector3> vertices, int first, int count, List<int> triangles) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00ee: Unknown result type (might be due to invalid IL or missing references) List<int> list = new List<int>(); for (int i = 0; i < count; i++) { list.Add(first + i); } int num = count * count; while (list.Count > 2 && num-- > 0) { bool flag = false; for (int j = 0; j < list.Count; j++) { int num2 = list[(j + list.Count - 1) % list.Count]; int num3 = list[j]; int num4 = list[(j + 1) % list.Count]; Vector3 val = vertices[num2]; Vector3 val2 = vertices[num3]; Vector3 val3 = vertices[num4]; if (Cross(val, val2, val3) <= 1E-06f) { continue; } bool flag2 = false; for (int k = 0; k < list.Count; k++) { int num5 = list[k]; if (num5 != num2 && num5 != num3 && num5 != num4) { Vector3 c = vertices[num5]; if (Cross(val, val2, c) >= -1E-06f && Cross(val2, val3, c) >= -1E-06f && Cross(val3, val, c) >= -1E-06f) { flag2 = true; break; } } } if (!flag2) { triangles.Add(num2); triangles.Add(num3); triangles.Add(num4); list.RemoveAt(j); flag = true; break; } } if (!flag) { Debug.LogWarning((object)"Gura shard outline could not be fully triangulated."); break; } } } public void Sample(float time, float strength, Color tint, float pixels, int tier) { //IL_00d6: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) if (!((Behaviour)this).isActiveAndEnabled || !Ready) { if (Object.op_Implicit((Object)(object)root)) { Release(); } return; } Build(); tier = Mathf.Clamp(tier, 0, 3); if (tier != cachedTier || seed != cachedSeed || sizeMultiplier != cachedSize || verticalRatio != cachedVertical || depth != cachedDepth || crackWidth != cachedWidth || tierWidths != cachedWidths) { Rebuild(tier); } if (!Application.isPlaying || time < 0f || lastTime < 0f || time < lastTime) { root.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); } lastTime = time; root.SetActive(strength > 0.0001f); if (root.activeSelf) { ((Renderer)surface).sharedMaterial = surfaceMaterial; block.Clear(); block.SetColor("_Tint", tint); block.SetFloat("_Strength", strength); block.SetFloat("_OffsetPixels", pixels); block.SetFloat("_FaceTint", faceTint); block.SetFloat("_FaceShade", faceShade); ((Renderer)surface).SetPropertyBlock(block); block.Clear(); block.SetColor("_Tint", tint); block.SetFloat("_Strength", strength); for (int i = 0; i < used; i++) { ((Renderer)lines[i]).sharedMaterial = crackMaterial; ((Renderer)lines[i]).SetPropertyBlock(block); } } } } [DisallowMultipleComponent] public sealed class WBGuraLayers : MonoBehaviour { [Range(0f, 3f)] public int chargeTier; public bool showFlash = true; public bool showRing = true; public bool showStreaks = true; [Min(0.1f)] public float sizeMultiplier = 1f; [Min(0f)] public float travelMultiplier = 1f; public Material accentMaterial; private GameObject root; private Mesh quad; private MeshRenderer flash; private MeshRenderer ring; private MeshRenderer echo; private LineRenderer[] streaks; private MaterialPropertyBlock block; private float lastTime = -1f; private int shotTier; private float shotSize; private float shotTravel; private void Awake() { Build(); } private void OnDisable() { if (Object.op_Implicit((Object)(object)root)) { root.SetActive(false); } lastTime = -1f; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)root)) { Object.Destroy((Object)(object)root); } if (Object.op_Implicit((Object)(object)quad)) { Object.Destroy((Object)(object)quad); } } private void Build() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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) if (!Object.op_Implicit((Object)(object)root) && Object.op_Implicit((Object)(object)accentMaterial)) { block = new MaterialPropertyBlock(); quad = new Mesh { name = "Gura Accent Quad" }; quad.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(0.5f, 0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f) }; quad.uv = (Vector2[])(object)new Vector2[4] { Vector2.zero, Vector2.right, Vector2.one, Vector2.up }; quad.colors = (Color[])(object)new Color[4] { Color.white, Color.white, Color.white, Color.white }; quad.triangles = new int[6] { 0, 1, 2, 0, 2, 3 }; quad.RecalculateBounds(); root = new GameObject("Gura Release Layers (runtime)"); flash = MakeQuad("Fist Flash"); ring = MakeQuad("Shock Ring"); echo = MakeQuad("Full Charge Echo"); streaks = (LineRenderer[])(object)new LineRenderer[7]; for (int i = 0; i < streaks.Length; i++) { GameObject val = new GameObject("Air Streak " + i); val.transform.SetParent(root.transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); ((Renderer)val2).sharedMaterial = accentMaterial; val2.useWorldSpace = false; val2.positionCount = 2; val2.alignment = (LineAlignment)0; val2.textureMode = (LineTextureMode)0; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; Color startColor = (val2.endColor = Color.white); val2.startColor = startColor; streaks[i] = val2; } root.SetActive(false); } } private MeshRenderer MakeQuad(string label) { //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_001d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(label); val.transform.SetParent(root.transform, false); val.AddComponent<MeshFilter>().sharedMesh = quad; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = accentMaterial; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return obj; } private void Paint(Renderer renderer, Color color, float opacity, float kind) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) block.Clear(); block.SetColor("_Tint", color); block.SetFloat("_Opacity", Mathf.Clamp01(opacity)); block.SetFloat("_Kind", kind); renderer.SetPropertyBlock(block); } public void Sample(float time, Color tint) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) if (!Application.isPlaying || !((Behaviour)this).isActiveAndEnabled) { return; } Build(); if (!Object.op_Implicit((Object)(object)root)) { return; } if (time < 0f) { root.SetActive(false); lastTime = -1f; return; } if (lastTime < 0f || time < lastTime) { root.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); shotTier = Mathf.Clamp(chargeTier, 0, 3); shotSize = Mathf.Max(0.1f, sizeMultiplier); shotTravel = Mathf.Max(0f, travelMultiplier); } lastTime = time; root.SetActive(time < 0.65f); if (!root.activeSelf) { return; } ((Renderer)flash).enabled = showFlash && time < 0.07f; ((Component)flash).transform.localScale = Vector3.one * shotSize * (1.4f + (float)shotTier * 0.25f); Paint((Renderer)(object)flash, tint, 1f - time / 0.07f, 0f); Ring(ring, time, 0f, tint, 1f); Ring(echo, time, 0.09f, tint, 0.45f); ((Renderer)echo).enabled = ((Renderer)echo).enabled && shotTier == 3; int num = 3 + shotTier; for (int i = 0; i < streaks.Length; i++) { LineRenderer val = streaks[i]; float num2 = time - 0.025f - (float)i * 0.006f; float num3 = 0.18f + (float)shotTier * 0.02f; if (((Renderer)val).enabled = showStreaks && i < num && num2 >= 0f && num2 < num3) { float num4 = num2 / num3; float num5 = (float)i * 2.399963f + 0.37f; Vector3 val2 = new Vector3(Mathf.Cos(num5), Mathf.Sin(num5), 0f); float num6 = shotSize * (0.5f + (2f + (float)shotTier * 0.5f) * num4); float num7 = (2f + (7f + (float)shotTier * 2f) * num4) * shotTravel; Vector3 val3 = val2 * num6 + Vector3.forward * num7; Vector3 val4 = val2 * (num6 * 0.65f) + Vector3.forward * (num7 - (1.5f + (float)shotTier * 0.4f) * shotTravel); val.SetPosition(0, val4); val.SetPosition(1, val3); val.startWidth = 0.05f * shotSize; val.endWidth = 0.015f * shotSize; Paint((Renderer)(object)val, tint, (1f - num4) * 0.65f, 2f); } } } private void Ring(MeshRenderer renderer, float time, float delay, Color tint, float opacity) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) float num = time - delay; float num2 = 0.28f + (float)shotTier * 0.04f; ((Renderer)renderer).enabled = showRing && num >= 0f && num < num2; if (((Renderer)renderer).enabled) { float num3 = num / num2; float num4 = Mathf.Lerp(0.6f, 4f + (float)shotTier * 1.3f, num3) * shotSize; ((Component)renderer).transform.localPosition = Vector3.forward * Mathf.Lerp(0.15f, 10f + (float)shotTier * 3f, num3) * shotTravel; ((Component)renderer).transform.localRotation = Quaternion.Euler(0f, 0f, (delay > 0f) ? 19f : 0f); ((Component)renderer).transform.localScale = Vector3.one * (num4 * 2f); Paint((Renderer)(object)renderer, tint, opacity * (1f - num3) * (1f - num3), 1f); } } } public static class WBGuraVFX { private static Material surface; private static Material cracks; private static Material accent; private static WBGuraSettings settings; private static bool warned; public static void Initialize(AssetBundle bundle) { warned = false; settings = null; if (!Object.op_Implicit((Object)(object)bundle)) { Debug.LogError((object)"[WB Gura VFX] AssetBundle missing."); return; } surface = bundle.LoadAsset<Material>("wbGuraSurface"); cracks = bundle.LoadAsset<Material>("wbGuraCracks"); accent = bundle.LoadAsset<Material>("wbGuraAccent"); TextAsset val = bundle.LoadAsset<TextAsset>("wbGuraSettings"); if (Object.op_Implicit((Object)(object)val)) { try { settings = JsonUtility.FromJson<WBGuraSettings>(val.text); } catch (Exception ex) { Debug.LogError((object)("[WB Gura VFX] Invalid settings: " + ex.Message)); } } if (!Object.op_Implicit((Object)(object)surface) || !Object.op_Implicit((Object)(object)cracks) || !Object.op_Implicit((Object)(object)accent) || settings == null || settings.version != 1) { Debug.LogError((object)"[WB Gura VFX] Missing runtime assets/settings. Export Gura runtime assets and rebuild whitebeardassets."); } else { Debug.Log((object)"[WB Gura VFX] Materials and settings loaded."); } } public static void Spawn(CharacterBody body, Ray aim, int tier) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active || !Object.op_Implicit((Object)(object)body)) { return; } if (!Object.op_Implicit((Object)(object)surface) || !Object.op_Implicit((Object)(object)cracks) || !Object.op_Implicit((Object)(object)accent) || settings == null || settings.version != 1) { if (!warned) { warned = true; Debug.LogError((object)"[WB Gura VFX] Spawn skipped: runtime assets missing."); } return; } Vector3 direction = ((Ray)(ref aim)).direction; Vector3 val; if (!(((Vector3)(ref direction)).sqrMagnitude > 0.0001f)) { val = body.transform.forward; } else { direction = ((Ray)(ref aim)).direction; val = ((Vector3)(ref direction)).normalized; } Vector3 val2 = val; Transform val3 = (Object.op_Implicit((Object)(object)body.modelLocator) ? body.modelLocator.modelTransform : null); ChildLocator val4 = (Object.op_Implicit((Object)(object)val3) ? ((Component)val3).GetComponent<ChildLocator>() : null); if (Object.op_Implicit((Object)(object)val4)) { val4.FindChild("GuraOrigin"); } Vector3 val5 = body.corePosition + Vector3.up * 1f + val2 * 5f; bool flag = false; ModelSkinController val6 = (Object.op_Implicit((Object)(object)val3) ? ((Component)val3).GetComponent<ModelSkinController>() : null); if (Object.op_Implicit((Object)(object)val6) && val6.skins != null && body.skinIndex < (uint)val6.skins.Length) { SkinDef val7 = val6.skins[body.skinIndex]; if (Object.op_Implicit((Object)(object)val7)) { flag = (!string.IsNullOrEmpty(val7.nameToken) && val7.nameToken.IndexOf("PRIME", StringComparison.OrdinalIgnoreCase) >= 0) || ((Object)val7).name.IndexOf("PRIME", StringComparison.OrdinalIgnoreCase) >= 0; } } Vector3 val8 = ((Mathf.Abs(Vector3.Dot(val2, Vector3.up)) > 0.99f) ? Vector3.forward : Vector3.up); GameObject val9 = new GameObject("WB Gura Release VFX"); val9.transform.SetPositionAndRotation(val5, Quaternion.LookRotation(val2, val8)); try { val9.AddComponent<WBGuraPlayback>().Initialize(settings, surface, cracks, accent, Mathf.Clamp(tier, 0, 3), flag ? new Color(0.35f, 1f, 0.65f, 1f) : new Color(0.55f, 0.85f, 1f, 1f)); } catch (Exception ex) { Object.Destroy((Object)(object)val9); Debug.LogError((object)("[WB Gura VFX] " + ex)); } } } public sealed class WBGuraPlayback : MonoBehaviour { private WBGuraBranches branches; private WBGuraLayers layers; private float elapsed; private float duration; private float pixels; private int tier; private Color tint; private bool ready; public void Initialize(WBGuraSettings s, Material surface, Material cracks, Material accent, int charge, Color color) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) duration = Mathf.Max(0.1f, s.duration); pixels = Mathf.Clamp(s.offsetPixels, 0f, 40f); tier = charge; tint = color; branches = ((Component)this).gameObject.AddComponent<WBGuraBranches>(); branches.surfaceMaterial = surface; branches.crackMaterial = cracks; branches.tierWidths = s.tierWidths; branches.sizeMultiplier = s.fractureSize; branches.verticalRatio = s.verticalRatio; branches.depth = s.depth; branches.crackWidth = s.crackWidth; branches.faceTint = s.faceTint; branches.faceShade = s.faceShade; branches.seed = s.seed; layers = ((Component)this).gameObject.AddComponent<WBGuraLayers>(); layers.accentMaterial = accent; layers.chargeTier = tier; layers.sizeMultiplier = s.accentSize; layers.travelMultiplier = s.accentTravel; layers.showFlash = s.showFlash; layers.showRing = s.showRing; layers.showStreaks = s.showStreaks; ready = true; Sample(); } private void Update() { if (ready) { elapsed += Time.deltaTime; if (elapsed >= Mathf.Max(duration, 0.65f)) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Sample(); } } } private void Sample() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) float strength = ((elapsed >= duration) ? 0f : (Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(elapsed / 0.04f)) * (1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(duration * 0.35f, duration, elapsed))))); branches.Sample(elapsed, strength, tint, pixels, tier); layers.Sample(elapsed, tint); } private void OnDisable() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)branches)) { branches.StopPreview(); } if (Object.op_Implicit((Object)(object)layers)) { layers.Sample(-1f, Color.white); } } } [DefaultExecutionOrder(100)] public sealed class WBBisentoTrail : MonoBehaviour { [Serializable] private class ContourData { public Vector2[] points; } private struct Sample { public Vector3 a; public Vector3 b; public float time; } private static Material material; private static bool warned; private static Vector2[] contourPoints; private float thickness; private readonly List<Vector2> kinds = new List<Vector2>(20000); private readonly List<Vector3> frameNormals = new List<Vector3>(1152); private Transform rootPoint; private Transform tipPoint; private Mesh mesh; private MeshRenderer meshRenderer; private bool emitting; private bool stopping; private bool previousValid; private Vector3 previousRoot; private Vector3 previousTip; private float life; private float strength; private float widthScale; private float tipExtension; private float depth; private readonly List<Sample> smooth = new List<Sample>(1152); private float smoothness; private readonly List<Sample> samples = new List<Sample>(96); private readonly List<Vector3> vertices = new List<Vector3>(192); private readonly List<Vector2> uv = new List<Vector2>(192); private readonly List<Color> colors = new List<Color>(192); private readonly List<int> triangles = new List<int>(570); public static void Initialize(AssetBundle bundle) { material = (Object.op_Implicit((Object)(object)bundle) ? bundle.LoadAsset<Material>("wbBisentoSlash") : null); warned = false; contourPoints = null; TextAsset val = (Object.op_Implicit((Object)(object)bundle) ? bundle.LoadAsset<TextAsset>("wbSlashContours") : null); if (Object.op_Implicit((Object)(object)val)) { try { contourPoints = JsonUtility.FromJson<ContourData>(val.text).points; } catch (Exception ex) { Debug.LogWarning((object)("[WB Trail] Contour parse failed: " + ex.Message)); } } if (contourPoints == null) { Debug.LogWarning((object)"[WB Trail] wbSlashContours missing. Run Apply Trail Volume and rebuild bundle; using flat trail until then."); } } public static WBBisentoTrail Begin(Transform model, bool heavy, float attackSpeed, int swingIndex = 0, bool air = false, CharacterBody owner = null) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active || !Object.op_Implicit((Object)(object)model)) { return null; } ChildLocator component = ((Component)model).GetComponent<ChildLocator>(); Transform val = (Object.op_Implicit((Object)(object)component) ? component.FindChild("BisentoTrailBase") : null); Transform val2 = (Object.op_Implicit((Object)(object)component) ? component.FindChild("BisentoTrailTip") : null); if (!Object.op_Implicit((Object)(object)material) || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2)) { if (!warned) { Debug.LogWarning((object)"[WB Bisento Trail] wbBisentoSlash material or BisentoTrailBase/Tip ChildLocator entries missing."); } warned = true; return null; } GameObject val3 = new GameObject("WB Bisento Swing Trail"); WBBisentoTrail wBBisentoTrail = val3.AddComponent<WBBisentoTrail>(); wBBisentoTrail.rootPoint = val; wBBisentoTrail.tipPoint = val2; wBBisentoTrail.life = Mathf.Clamp(material.GetFloat("_TrailLife") * (heavy ? 1.2f : 1f) / Mathf.Sqrt(Mathf.Max(0.1f, attackSpeed)), 0.045f, 0.6f); wBBisentoTrail.widthScale = Mathf.Clamp(material.GetFloat("_WidthScale"), 0.1f, 4f); wBBisentoTrail.tipExtension = Mathf.Clamp(material.GetFloat("_TipExtension"), 0f, 5f); wBBisentoTrail.smoothness = (material.HasProperty("_Smoothing") ? Mathf.Clamp01(material.GetFloat("_Smoothing")) : 1f); wBBisentoTrail.depth = Mathf.Clamp(material.GetFloat("_RibbonDepth"), 0f, 1f); wBBisentoTrail.thickness = ((contourPoints != null && material.HasProperty("_Thickness")) ? Mathf.Clamp(material.GetFloat("_Thickness"), 0f, 0.6f) : 0f); wBBisentoTrail.strength = (heavy ? 1f : 0.9f); wBBisentoTrail.mesh = new Mesh { name = "WB Bisento Volume", indexFormat = (IndexFormat)1 }; wBBisentoTrail.mesh.MarkDynamic(); val3.AddComponent<MeshFilter>().sharedMesh = wBBisentoTrail.mesh; wBBisentoTrail.meshRenderer = val3.AddComponent<MeshRenderer>(); ((Renderer)wBBisentoTrail.meshRenderer).sharedMaterial = material; ((Renderer)wBBisentoTrail.meshRenderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)wBBisentoTrail.meshRenderer).receiveShadows = false; ((Renderer)wBBisentoTrail.meshRenderer).enabled = false; CharacterBody val4 = (Object.op_Implicit((Object)(object)owner) ? owner : ((Component)model).GetComponentInParent<CharacterBody>()); ModelSkinController component2 = ((Component)model).GetComponent<ModelSkinController>(); bool flag = false; if (Object.op_Implicit((Object)(object)val4) && Object.op_Implicit((Object)(object)component2) && component2.skins != null && val4.skinIndex < (uint)component2.skins.Length) { SkinDef val5 = component2.skins[val4.skinIndex]; if (Object.op_Implicit((Object)(object)val5)) { flag = (val5.nameToken + " " + ((Object)val5).name).IndexOf("PRIME", StringComparison.OrdinalIgnoreCase) >= 0; } } MaterialPropertyBlock val6 = new MaterialPropertyBlock(); val6.SetColor("_Tint", material.GetColor(flag ? "_PrimeEdge" : "_OldEdge")); val6.SetColor("_BodyColor", material.GetColor(flag ? "_PrimeBody" : "_OldBody")); ((Renderer)wBBisentoTrail.meshRenderer).SetPropertyBlock(val6); return wBBisentoTrail; } public void SetEmitting(bool value) { if (!stopping) { if (value && !emitting) { samples.Clear(); previousValid = false; } emitting = value; } } public void Stop() { emitting = false; stopping = true; } private void LateUpdate() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; while (samples.Count > 1 && time - samples[1].time >= life) { samples.RemoveAt(0); } if (samples.Count == 1 && time - samples[0].time >= life) { samples.Clear(); } if (!Object.op_Implicit((Object)(object)rootPoint) || !Object.op_Implicit((Object)(object)tipPoint) || !((Component)rootPoint).gameObject.activeInHierarchy) { Stop(); } if (!stopping) { Vector3 position = rootPoint.position; Vector3 position2 = tipPoint.position; Vector3 val = position2 - position; position2 = position + val * widthScale + ((Vector3)(ref val)).normalized * tipExtension; bool flag = previousValid && (Vector3.Distance(position2, previousTip) > 12f || Vector3.Distance(position, previousRoot) > 12f); if (flag) { samples.Clear(); } if (emitting) { if (samples.Count == 0 && previousValid && !flag) { samples.Add(new Sample { a = previousRoot, b = previousTip, time = time - Mathf.Min(Time.deltaTime, life * 0.5f) }); } if (samples.Count == 0 || Vector3.SqrMagnitude(position2 - samples[samples.Count - 1].b) > 0.0004f || Vector3.SqrMagnitude(position - samples[samples.Count - 1].a) > 0.0004f) { samples.Add(new Sample { a = position, b = position2, time = time }); } } previousRoot = position; previousTip = position2; previousValid = true; } if (samples.Count > 96) { samples.RemoveRange(0, samples.Count - 96); } Draw(time); if (stopping && samples.Count == 0) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private static Vector3 Curve(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t0, float t1, float t2, float t3, float t, float amount) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(1E-05f, t2 - t1); float num2 = Vector3.Distance(p1, p2) * 1.5f; Vector3 val = Vector3.ClampMagnitude((p2 - p0) * (num / Mathf.Max(1E-05f, t2 - t0)), num2); Vector3 val2 = Vector3.ClampMagnitude((p3 - p1) * (num / Mathf.Max(1E-05f, t3 - t1)), num2); float num3 = t * t; float num4 = num3 * t; Vector3 val3 = (2f * num4 - 3f * num3 + 1f) * p1 + (num4 - 2f * num3 + t) * val + (-2f * num4 + 3f * num3) * p2 + (num4 - num3) * val2; return Vector3.Lerp(Vector3.Lerp(p1, p2, t), val3, amount); } private void SmoothSamples() { //IL_0066: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) smooth.Clear(); for (int i = 0; i < samples.Count - 1; i++) { Sample sample = samples[Mathf.Max(0, i - 1)]; Sample sample2 = samples[i]; Sample sample3 = samples[i + 1]; Sample sample4 = samples[Mathf.Min(samples.Count - 1, i + 2)]; int num = Mathf.Clamp(Mathf.CeilToInt(Mathf.Max(Vector3.Distance(sample2.a, sample3.a), Vector3.Distance(sample2.b, sample3.b)) / 0.18f), 3, 12); for (int j = 0; j < num; j++) { float num2 = (float)j / (float)num; smooth.Add(new Sample { a = Curve(sample.a, sample2.a, sample3.a, sample4.a, sample.time, sample2.time, sample3.time, sample4.time, num2, smoothness), b = Curve(sample.b, sample2.b, sample3.b, sample4.b, sample.time, sample2.time, sample3.time, sample4.time, num2, smoothness), time = Mathf.Lerp(sample2.time, sample3.time, num2) }); } } smooth.Add(samples[samples.Count - 1]); } private float Fade(float age) { return (1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.25f, 1f, age))) * strength; } private int Vertex(Vector3 pos, Vector2 tex, float alpha, float kind) { //IL_0011: 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_0039: 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) int count = vertices.Count; vertices.Add(pos); uv.Add(tex); colors.Add(new Color(1f, 1f, 1f, alpha)); kinds.Add(new Vector2(kind, 0f)); return count; } private void Tri(int a, int b, int c) { triangles.Add(a); triangles.Add(b); triangles.Add(c); } private Vector3 Point(Sample s, Vector3 normal, float v) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) return Vector3.Lerp(s.a, s.b, v) + normal * (depth * Mathf.Sin(v * MathF.PI)); } private float Half(float age) { return thickness * 0.5f * (1f - 0.7f * age); } private void Side(Vector3 p, Vector3 q, Vector3 np, Vector3 nq, Vector2 up, Vector2 uq, float kind) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) int count = vertices.Count; Vertex(p + np * Half(up.x), up, Fade(up.x), kind); Vertex(p - np * Half(up.x), up, Fade(up.x), kind); Vertex(q + nq * Half(uq.x), uq, Fade(uq.x), kind); Vertex(q - nq * Half(uq.x), uq, Fade(uq.x), kind); Tri(count, count + 1, count + 2); Tri(count + 2, count + 1, count + 3); Tri(count + 2, count + 1, count); Tri(count + 3, count + 1, count + 2); } private void AtUV(Vector2 tex, float now, out Vector3 pos, out Vector3 normal) { //IL_0001: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = now - tex.x * life; int num2 = 0; int num3 = smooth.Count - 1; while (num3 - num2 > 1) { int num4 = (num2 + num3) / 2; if (smooth[num4].time < num) { num2 = num4; } else { num3 = num4; } } float num5 = Mathf.InverseLerp(smooth[num2].time, smooth[num3].time, num); Vector3 val = Vector3.Lerp(frameNormals[num2], frameNormals[num3], num5); normal = ((Vector3)(ref val)).normalized; Sample s = new Sample { a = Vector3.Lerp(smooth[num2].a, smooth[num3].a, num5), b = Vector3.Lerp(smooth[num2].b, smooth[num3].b, num5) }; pos = Point(s, normal, tex.y); } private void Walls(float now) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_009d: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((now - smooth[smooth.Count - 1].time) / life); float num2 = Mathf.Clamp01((now - smooth[0].time) / life); for (int i = 0; i + 1 < contourPoints.Length; i += 2) { Vector2 val = contourPoints[i]; Vector2 val2 = contourPoints[i + 1]; if (val.x > val2.x) { Vector2 val3 = val; val = val2; val2 = val3; } if (!(val2.x < num) && !(val.x > num2)) { Vector2 val4 = val; Vector2 val5 = val2; if (val.x < num) { val = Vector2.Lerp(val4, val5, Mathf.InverseLerp(val4.x, val5.x, num)); } if (val2.x > num2) { val2 = Vector2.Lerp(val4, val5, Mathf.InverseLerp(val4.x, val5.x, num2)); } Vector2 val6 = val2 - val; if (!(((Vector2)(ref val6)).sqrMagnitude < 1E-10f)) { AtUV(val, now, out var pos, out var normal); AtUV(val2, now, out var pos2, out var normal2); Side(pos, pos2, normal, normal2, val, val2, 1f); } } } Vector2 val7 = default(Vector2); Vector2 val8 = default(Vector2); for (int j = 0; j < 2; j++) { float num3 = ((j == 0) ? num : num2); for (int k = 0; k < 32; k++) { ((Vector2)(ref val7))..ctor(num3, (float)k / 32f); ((Vector2)(ref val8))..ctor(num3, (float)(k + 1) / 32f); AtUV(val7, now, out var pos3, out var normal3); AtUV(val8, now, out var pos4, out var normal4); Side(pos3, pos4, normal3, normal4, val7, val8, 2f); } } } private void Draw(float now) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); ((Renderer)meshRenderer).enabled = samples.Count >= 2; if (samples.Count < 2) { return; } vertices.Clear(); uv.Clear(); colors.Clear(); triangles.Clear(); kinds.Clear(); frameNormals.Clear(); SmoothSamples(); Vector3 val = Vector3.zero; for (int i = 0; i < smooth.Count; i++) { Sample sample = smooth[i]; Sample sample2 = smooth[Mathf.Max(0, i - 1)]; Sample sample3 = smooth[Mathf.Min(smooth.Count - 1, i + 1)]; Vector3 val2 = Vector3.Cross(sample.b - sample.a, (sample3.a + sample3.b - sample2.a - sample2.b) * 0.5f); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = val; } if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val2 = Vector3.Cross(sample.b - sample.a, Vector3.up); val3 = ((Vector3)(ref val2)).normalized; } if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.right; } if (Vector3.Dot(val3, val) < 0f) { val3 = -val3; } frameNormals.Add(val3); val = val3; } int num = ((!(thickness > 0.0001f)) ? 1 : 2); for (int j = 0; j < num; j++) { int count = vertices.Count; float num2 = ((j == 0) ? 1 : (-1)); for (int k = 0; k < smooth.Count; k++) { Sample s = smooth[k]; float num3 = Mathf.Clamp01((now - s.time) / life); Vector3 val4 = frameNormals[k]; for (int l = 0; l <= 6; l++) { float num4 = (float)l / 6f; Vertex(Point(s, val4, num4) + val4 * (Half(num3) * num2), new Vector2(num3, num4), Fade(num3), 0f); if (k == 0 || l == 0) { continue; } int num5 = count + k * 7 + l; int num6 = num5 - 6 - 2; int num7 = num5 - 6 - 1; int num8 = num5 - 1; int num9 = num5; bool flag = Vector3.Dot(Vector3.Cross(vertices[num7] - vertices[num6], vertices[num8] - vertices[num6]), val4) * num2 < 0f; if (flag) { Tri(num6, num8, num7); Tri(num8, num9, num7); } else { Tri(num6, num7, num8); Tri(num8, num7, num9); } if (num == 1) { if (flag) { Tri(num6, num7, num8); Tri(num8, num7, num9); } else { Tri(num6, num8, num7); Tri(num8, num9, num7); } } } } } if (thickness > 0.0001f && contourPoints != null) { Walls(now); } mesh.SetVertices(vertices); mesh.SetUVs(0, uv); mesh.SetUVs(1, kinds); mesh.SetColors(colors); mesh.SetTriangles(triangles, 0); mesh.RecalculateBounds(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } } public static class WBGroundVFX { public static float WalkScale = 1.6f; public static float SprintScale = 2.1f; public static float LandingScale = 3f; public static float SlamScale = 1.8f; private static GameObject dust; private static GameObject slam; private static GameObject storage; private static bool initialized; public static void Initialize() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!initialized) { initialized = true; storage = new GameObject("WB Ground VFX Templates"); storage.SetActive(false); Object.DontDestroyOnLoad((Object)(object)storage); dust = Prepare(LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust")); slam = Prepare(FindAsset("BeetleGuardGroundSlam.prefab")); if (!Object.op_Implicit((Object)(object)dust)) { Debug.LogWarning((object)"[Whitebeard] GenericFootstepDust missing: ground dust disabled."); } if (!Object.op_Implicit((Object)(object)slam)) { Debug.LogWarning((object)"[Whitebeard] BeetleGuardGroundSlam missing: using enlarged vanilla dust for slam."); } } } private static GameObject FindAsset(string filename) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) string text = null; foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators) { foreach (object key in resourceLocator.Keys) { if (key is string text2 && text2.EndsWith("/" + filename, StringComparison.OrdinalIgnoreCase) && (text == null || string.CompareOrdinal(text2, text) < 0)) { text = text2; } } } if (text == null) { return null; } try { return Addressables.LoadAssetAsync<GameObject>((object)text).WaitForCompletion(); } catch (Exception ex) { Debug.LogWarning((object)("[Whitebeard] Ground VFX load failed: " + ex.Message)); return null; } } private static GameObject Prepare(GameObject source) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)source)) { return null; } GameObject val = Object.Instantiate<GameObject>(source, storage.transform); val.SetActive(false); ShakeEmitter[] componentsInChildren = val.GetComponentsInChildren<ShakeEmitter>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } AudioSource[] componentsInChildren2 = val.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource obj in componentsInChildren2) { obj.playOnAwake = false; ((Behaviour)obj).enabled = false; } EffectComponent[] componentsInChildren3 = val.GetComponentsInChildren<EffectComponent>(true); foreach (EffectComponent obj2 in componentsInChildren3) { obj2.soundName = ""; obj2.applyScale = false; } ParticleSystem[] componentsInChildren4 = val.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { MainModule main = componentsInChildren4[i].main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; } return val; } internal static bool Ground(Vector3 near, out RaycastHit hit) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) return Physics.Raycast(near + Vector3.up * 2f, Vector3.down, ref hit, 5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } internal static void Puff(Vector3 point, Vector3 normal, float scale, bool impact) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b8: Expected O, but got Unknown if (!NetworkClient.active) { return; } if (!initialized) { Initialize(); } GameObject val = ((impact && Object.op_Implicit((Object)(object)slam)) ? slam : dust); if (Object.op_Implicit((Object)(object)val)) { if (impact && !Object.op_Implicit((Object)(object)slam)) { scale *= 3f; } GameObject val2 = Object.Instantiate<GameObject>(val, point + normal * 0.03f, Quaternion.FromToRotation(Vector3.up, normal)); val2.transform.localScale = val.transform.localScale * scale; EffectComponent component = val2.GetComponent<EffectComponent>(); if (Object.op_Implicit((Object)(object)component)) { component.effectData = new EffectData { origin = point, scale = scale }; } val2.SetActive(true); ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Play(false); } Object.Destroy((Object)(object)val2, impact ? 5f : 3f); } } public static void Footstep(CharacterBody body) { if (NetworkClient.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.characterMotor) && body.characterMotor.isGrounded) { WBFootDust wBFootDust = ((Component)body).GetComponent<WBFootDust>(); if (!Object.op_Implicit((Object)(object)wBFootDust)) { wBFootDust = ((Component)body).gameObject.AddComponent<WBFootDust>(); } wBFootDust.Step(body); } } public static void Landing(CharacterBody body, bool dive = false, float strength = 0f) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (NetworkClient.active && Object.op_Implicit((Object)(object)body) && Ground(body.footPosition, out var hit)) { Puff(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, dive ? SlamScale : (LandingScale * Mathf.Lerp(1f, 2.5f, Mathf.Clamp01(strength))), dive); } } } public sealed class WBFootDust : MonoBehaviour { private Transform model; private Transform left; private Transform right; private bool nextLeft = true; public void Step(CharacterBody body) { //IL_00e1: 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_010e: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) Transform val = (Object.op_Implicit((Object)(object)body.modelLocator) ? body.modelLocator.modelTransform : null); if (!Object.op_Implicit((Object)(object)val)) { return; } if ((Object)(object)model != (Object)(object)val) { model = val; left = (right = null); Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name == "Foot.L") { left = val2; } else if (((Object)val2).name == "Foot.R") { right = val2; } } } Transform val3 = (nextLeft ? left : right); if (Object.op_Implicit((Object)(object)left) && Object.op_Implicit((Object)(object)right) && Mathf.Abs(left.position.y - right.position.y) > 0.12f) { val3 = ((left.position.y < right.position.y) ? left : right); } nextLeft = (Object.op_Implicit((Object)(object)val3) ? ((Object)(object)val3 != (Object)(object)left) : (!nextLeft)); if (WBGroundVFX.Ground(Object.op_Implicit((Object)(object)val3) ? val3.position : body.footPosition, out var hit)) { WBGroundVFX.Puff(((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, body.isSprinting ? WBGroundVFX.SprintScale : WBGroundVFX.WalkScale, impact: false); } } } public sealed class WBGuraChargeFx : MonoBehaviour { private static Material chargeMaterial; private static bool warned; private CharacterBody body; private Transform anchor; private GameObject shell; private GameObject pulse; private Renderer shellRenderer; private Renderer pulseRenderer; private MaterialPropertyBlock block; private Color tint; private float chargeTime; private float lastPulse = -100f; private int lastTier; public static void Initialize(AssetBundle bundle) { chargeMaterial = (Object.op_Implicit((Object)(object)bundle) ? bundle.LoadAsset<Material>("wbGuraCharge") : null); warned = false; if (!Object.op_Implicit((Object)(object)chargeMaterial)) { Debug.LogWarning((object)"[WB Gura Charge] wbGuraCharge material missing; release is unaffected."); } } public static WBGuraChargeFx Begin(CharacterBody body) { //IL_003b: 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_01ba: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown if (!NetworkClient.active || !Object.op_Implicit((Object)(object)body)) { return null; } if (!Object.op_Implicit((Object)(object)chargeMaterial)) { if (!warned) { warned = true; Debug.LogWarning((object)"[WB Gura Charge] Export material and rebuild bundle."); } return null; } WBGuraChargeFx wBGuraChargeFx = new GameObject("WB Gura Charge VFX").AddComponent<WBGuraChargeFx>(); wBGuraChargeFx.body = body; Transform val = (Object.op_Implicit((Object)(object)body.modelLocator) ? body.modelLocator.modelTransform : null); ChildLocator val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<ChildLocator>() : null); wBGuraChargeFx.anchor = (Object.op_Implicit((Object)(object)val2) ? val2.FindChild("GuraChargeOrigin") : null); if (!Object.op_Implicit((Object)(object)wBGuraChargeFx.anchor) && Object.op_Implicit((Object)(object)val2)) { wBGuraChargeFx.anchor = val2.FindChild("GuraOrigin"); } if (!Object.op_Implicit((Object)(object)wBGuraChargeFx.anchor) && Object.op_Implicit((Object)(object)val)) { Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "Hand.L") { wBGuraChargeFx.anchor = val3; break; } } } bool flag = false; ModelSkinController val4 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<ModelSkinController>() : null); if (Object.op_Implicit((Object)(object)val4) && val4.skins != null && body.skinIndex < (uint)val4.skins.Length) { SkinDef val5 = val4.skins[body.skinIndex]; if (Object.op_Implicit((Object)(object)val5)) { flag = (!string.IsNullOrEmpty(val5.nameToken) && val5.nameToken.IndexOf("PRIME", StringComparison.OrdinalIgnoreCase) >= 0) || ((Object)val5).name.IndexOf("PRIME", StringComparison.OrdinalIgnoreCase) >= 0; } } wBGuraChargeFx.tint = (flag ? new Color(0.35f, 1f, 0.65f, 1f) : new Color(0.55f, 0.85f, 1f, 1f)); wBGuraChargeFx.block = new MaterialPropertyBlock(); wBGuraChargeFx.shell = wBGuraChargeFx.MakeSphere("Charge shell", out wBGuraChargeFx.shellRenderer); wBGuraChargeFx.pulse = wBGuraChargeFx.MakeSphere("Tier pulse", out wBGuraChargeFx.pulseRenderer); wBGuraChargeFx.pulse.SetActive(false); wBGuraChargeFx.LateUpdate(); return wBGuraChargeFx; } private GameObject MakeSphere(string label, out Renderer renderer) { GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = label; val.transform.SetParent(((Component)this).transform, false); Collider component = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false;