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 Jason Asano v1.0.1
plugins/Jason.Core.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Numerics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; [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("Jason.Core")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("Jason.Core")] [assembly: AssemblyTitle("Jason.Core")] [assembly: AssemblyMetadata("ProjectSteward", "Sapherno")] [assembly: AssemblyMetadata("ReuseTerms", "Free fan mod. Original work requires explicit permission for redistribution, subject to applicable law and existing licenses. No sales or paywalls. See RIGHTS-NOTICE.md.")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Sapherno.Jason.Core { public enum AbilityId : byte { MidnightEyes, CloakOfNight, PathOfShadows, HandOfTheReaper, Shade, BloodHarvest, LeechBite, FeastOfBlood, Colin, Haemorrhage, Punish, FeastOfAbsolution, SinEater, Hegemony, Castigate, InexorableDoom, Punition, BladeOfDoom, Verdict, Gordon } public enum AbilityUse { Passive, Dedicated, Active, Familiar } public sealed class AbilityDefinition { public AbilityId Id { get; } public Essence Essence { get; } public string Name { get; } public string Stone { get; } public AbilityUse Use { get; } public bool InitialGift => Stone.Length == 0; internal AbilityDefinition(AbilityId id, Essence essence, string name, string stone, AbilityUse use) { Id = id; Essence = essence; Name = name; Stone = stone; Use = use; } } public static class AbilityCatalog { public const uint AllMask = 1048575u; public static IReadOnlyList<AbilityDefinition> All { get; } = Array.AsReadOnly(new AbilityDefinition[20] { new AbilityDefinition(AbilityId.MidnightEyes, Essence.Dark, "Midnight Eyes", "", AbilityUse.Passive), new AbilityDefinition(AbilityId.CloakOfNight, Essence.Dark, "Cloak of Night", "Stars", AbilityUse.Dedicated), new AbilityDefinition(AbilityId.PathOfShadows, Essence.Dark, "Path of Shadows", "Adventure", AbilityUse.Dedicated), new AbilityDefinition(AbilityId.HandOfTheReaper, Essence.Dark, "Hand of the Reaper", "Reaper", AbilityUse.Dedicated), new AbilityDefinition(AbilityId.Shade, Essence.Dark, "Shadow of the Reaper", "Reaper", AbilityUse.Familiar), new AbilityDefinition(AbilityId.BloodHarvest, Essence.Blood, "Blood Harvest", "", AbilityUse.Active), new AbilityDefinition(AbilityId.LeechBite, Essence.Blood, "Leech Bite", "Feast", AbilityUse.Passive), new AbilityDefinition(AbilityId.FeastOfBlood, Essence.Blood, "Feast of Blood", "Feast", AbilityUse.Active), new AbilityDefinition(AbilityId.Colin, Essence.Blood, "Sanguine Horror", "Apocalypse", AbilityUse.Familiar), new AbilityDefinition(AbilityId.Haemorrhage, Essence.Blood, "Haemorrhage", "Magus", AbilityUse.Active), new AbilityDefinition(AbilityId.Punish, Essence.Sin, "Punish", "", AbilityUse.Passive), new AbilityDefinition(AbilityId.FeastOfAbsolution, Essence.Sin, "Feast of Absolution", "Feast", AbilityUse.Active), new AbilityDefinition(AbilityId.SinEater, Essence.Sin, "Sin Eater", "Feast", AbilityUse.Passive), new AbilityDefinition(AbilityId.Hegemony, Essence.Sin, "Hegemony", "Omens", AbilityUse.Passive), new AbilityDefinition(AbilityId.Castigate, Essence.Sin, "Castigate", "Magus", AbilityUse.Active), new AbilityDefinition(AbilityId.InexorableDoom, Essence.Doom, "Inexorable Doom", "", AbilityUse.Passive), new AbilityDefinition(AbilityId.Punition, Essence.Doom, "Punition", "Wrath", AbilityUse.Active), new AbilityDefinition(AbilityId.BladeOfDoom, Essence.Doom, "Blade of Doom", "Absolution", AbilityUse.Passive), new AbilityDefinition(AbilityId.Verdict, Essence.Doom, "Verdict", "Judgement", AbilityUse.Active), new AbilityDefinition(AbilityId.Gordon, Essence.Doom, "Avatar of Doom", "Avatar", AbilityUse.Familiar) }); public static AbilityDefinition Get(AbilityId id) { if ((int)id >= All.Count) { throw new ArgumentOutOfRangeException("id"); } return All[(int)id]; } public static uint Bit(AbilityId id) { Get(id); return (uint)(1 << (int)id); } public static uint Mask(Essence essence) { ProgressionRules.RequireSingleEssence(essence); uint num = 0u; foreach (AbilityDefinition item in All) { if (item.Essence == essence) { num |= Bit(item.Id); } } return num; } public static AbilityId Gift(Essence essence) { ProgressionRules.RequireSingleEssence(essence); foreach (AbilityDefinition item in All) { if (item.Essence == essence && item.InitialGift) { return item.Id; } } throw new ArgumentOutOfRangeException("essence"); } } public sealed class AbilitySelector { public const double HoldSeconds = 0.25; private double pressedAt; private bool scrolled; public int Selected { get; private set; } public bool Held { get; private set; } public bool Open { get; private set; } public bool Begin(double now) { ValidTime(now); if (Held) { return false; } Held = true; Open = false; scrolled = false; pressedAt = now; return true; } public void Update(double now) { ValidTime(now); if (Held && now - pressedAt >= 0.25) { Open = true; } } public void Scroll(int direction, int count) { if (Held && direction != 0 && count > 0) { Open = true; scrolled = true; Selected = ((Selected + Math.Sign(direction)) % count + count) % count; } } public int? Release(double now, int count) { Update(now); bool num = Held && !Open && !scrolled && now >= pressedAt && now - pressedAt < 0.25; Held = false; Open = false; scrolled = false; if (!num || count <= 0) { return null; } return Selected % count; } public void Reset() { Cancel(); Selected = 0; } public void Select(int index, int count) { if (index < 0 || index >= count) { throw new ArgumentOutOfRangeException("index"); } Selected = index; } public void Cancel() { Held = false; Open = false; scrolled = false; } public void Clamp(int count) { if (count <= 0) { Selected = 0; } else { Selected = Math.Min(Selected, count - 1); } } private static void ValidTime(double time) { ProgressionRules.RequireFiniteNonNegative(time, "time"); } } public enum SelectorGroup : byte { Blood, Sin, Doom, Shade, Colin, Gordon } public enum FamiliarCommand : byte { Summon, Manifest, Withdraw, Swarm, BloodClone, WormThatWalks, ApocalypseBeast } public static class SelectorCatalog { public static readonly AbilityId[] Blood = new AbilityId[3] { AbilityId.BloodHarvest, AbilityId.Haemorrhage, AbilityId.FeastOfBlood }; public static readonly AbilityId[] Sin = new AbilityId[2] { AbilityId.Castigate, AbilityId.FeastOfAbsolution }; public static readonly AbilityId[] Doom = new AbilityId[2] { AbilityId.Punition, AbilityId.Verdict }; private static readonly FamiliarCommand[][] ColinCommands = new FamiliarCommand[4][] { new FamiliarCommand[3] { FamiliarCommand.Summon, FamiliarCommand.Withdraw, FamiliarCommand.Swarm }, new FamiliarCommand[4] { FamiliarCommand.Summon, FamiliarCommand.Withdraw, FamiliarCommand.Swarm, FamiliarCommand.WormThatWalks }, new FamiliarCommand[5] { FamiliarCommand.Summon, FamiliarCommand.Withdraw, FamiliarCommand.Swarm, FamiliarCommand.WormThatWalks, FamiliarCommand.BloodClone }, new FamiliarCommand[6] { FamiliarCommand.Summon, FamiliarCommand.Withdraw, FamiliarCommand.Swarm, FamiliarCommand.WormThatWalks, FamiliarCommand.BloodClone, FamiliarCommand.ApocalypseBeast } }; private static readonly FamiliarCommand[] manifest = new FamiliarCommand[3] { FamiliarCommand.Summon, FamiliarCommand.Manifest, FamiliarCommand.Withdraw }; public static AbilityId[] Abilities(SelectorGroup group) { return group switch { SelectorGroup.Blood => (AbilityId[])Blood.Clone(), SelectorGroup.Sin => (AbilityId[])Sin.Clone(), SelectorGroup.Doom => (AbilityId[])Doom.Clone(), _ => throw new ArgumentOutOfRangeException("group"), }; } public static string Label(FamiliarCommand command) { return command switch { FamiliarCommand.WormThatWalks => "The Worm That Walks", FamiliarCommand.BloodClone => "Blood Clone", FamiliarCommand.ApocalypseBeast => "Apocalypse Beast", _ => command.ToString(), }; } public static FamiliarCommand[] Commands(SelectorGroup group, Rank? bloodRank) { return (FamiliarCommand[])Menu(group, bloodRank).Clone(); } public static int CommandCount(SelectorGroup group, Rank? rank) { return Menu(group, rank).Length; } public static FamiliarCommand CommandAt(SelectorGroup group, Rank? rank, int index) { return Menu(group, rank)[index]; } private static FamiliarCommand[] Menu(SelectorGroup group, Rank? bloodRank) { switch (group) { case SelectorGroup.Shade: case SelectorGroup.Gordon: return manifest; default: throw new ArgumentOutOfRangeException("group"); case SelectorGroup.Colin: return ColinCommands[(bloodRank >= Rank.Gold) ? 3 : ((bloodRank >= Rank.Silver) ? 2 : ((bloodRank >= Rank.Bronze) ? 1 : 0))]; } } } public enum UnlockKnowledge { Unknown, Locked, Unlocked } public enum ArrivalDecision { Suppress, WaitForProfiles, Eligible } public readonly struct PlayerUnlockStatus { public bool EligibleParticipant { get; } public UnlockKnowledge Otherworlder { get; } public PlayerUnlockStatus(bool eligibleParticipant, UnlockKnowledge otherworlder) { if (otherworlder < UnlockKnowledge.Unknown || otherworlder > UnlockKnowledge.Unlocked) { throw new ArgumentOutOfRangeException("otherworlder"); } EligibleParticipant = eligibleParticipant; Otherworlder = otherworlder; } } public static class ArrivalEligibility { public static ArrivalDecision Evaluate(bool isHost, IEnumerable<PlayerUnlockStatus> players) { if (players == null) { throw new ArgumentNullException("players"); } if (!isHost) { return ArrivalDecision.Suppress; } bool flag = false; foreach (PlayerUnlockStatus player in players) { if (player.EligibleParticipant) { if (player.Otherworlder == UnlockKnowledge.Locked) { return ArrivalDecision.Eligible; } if (player.Otherworlder == UnlockKnowledge.Unknown) { flag = true; } } } if (!flag) { return ArrivalDecision.Suppress; } return ArrivalDecision.WaitForProfiles; } } public sealed class ArrivalSpawnGate { private bool reserved; private bool spawnedThisStage; public bool TryCreate(bool isHost, Func<IEnumerable<PlayerUnlockStatus>> readCurrentPlayers, Func<bool> createOnValidGround) { if (readCurrentPlayers == null) { throw new ArgumentNullException("readCurrentPlayers"); } if (createOnValidGround == null) { throw new ArgumentNullException("createOnValidGround"); } if (!isHost || reserved || spawnedThisStage) { return false; } reserved = true; try { if (ArrivalEligibility.Evaluate(isHost: true, readCurrentPlayers()) != ArrivalDecision.Eligible) { return false; } bool num = createOnValidGround(); if (num) { spawnedThisStage = true; } return num; } finally { reserved = false; } } } public enum ArrivalPhase : byte { Waiting, Sick, Standing, Smoke, Finished } public sealed class ArrivalSequence { private double deadline; public ArrivalPhase Phase { get; private set; } public bool Begin(double now) { if (Phase != ArrivalPhase.Waiting) { return false; } Phase = ArrivalPhase.Sick; deadline = now + 2.8; return true; } public bool Advance(double now) { if (Phase == ArrivalPhase.Waiting || Phase == ArrivalPhase.Finished || now < deadline) { return false; } if (Phase == ArrivalPhase.Sick) { Phase = ArrivalPhase.Standing; deadline = now + 1.5; } else if (Phase == ArrivalPhase.Standing) { Phase = ArrivalPhase.Smoke; deadline = now + 1.1; } else { Phase = ArrivalPhase.Finished; } return true; } } public sealed class AttackContactClock { private readonly double[] contacts; private int next; private double age; private bool cancelled; public AttackContactClock(IReadOnlyList<float> times) { if (times == null) { throw new ArgumentNullException("times"); } contacts = new double[times.Count]; for (int i = 0; i < times.Count; i++) { if (float.IsNaN(times[i]) || float.IsInfinity(times[i]) || times[i] < 0f || (i > 0 && times[i] <= times[i - 1])) { throw new ArgumentException("Contacts must be finite, ordered and unique."); } contacts[i] = times[i]; } } public IReadOnlyList<int> Advance(double sourceSeconds) { if (double.IsNaN(sourceSeconds) || double.IsInfinity(sourceSeconds) || sourceSeconds < age) { throw new ArgumentOutOfRangeException("sourceSeconds"); } age = sourceSeconds; List<int> list = new List<int>(); if (cancelled) { return list; } while (next < contacts.Length && contacts[next] <= age) { list.Add(next++); } return list; } public void Cancel() { cancelled = true; } } public readonly struct AttackSample { public int Window { get; } public float SourceSeconds { get; } public AttackSample(int window, float seconds) { Window = window; SourceSeconds = seconds; } } public sealed class AttackWindowClock { private readonly List<AttackSample> samples = new List<AttackSample>(); private int next; private double age; private bool cancelled; public AttackWindowClock(IReadOnlyList<(float Start, float End)> windows) { for (int i = 0; i < windows.Count; i++) { (float, float) tuple = windows[i]; if (float.IsNaN(tuple.Item1) || float.IsNaN(tuple.Item2) || float.IsInfinity(tuple.Item1) || float.IsInfinity(tuple.Item2) || tuple.Item1 < 0f || tuple.Item2 < tuple.Item1 || tuple.Item2 > 60f || (i > 0 && tuple.Item1 <= windows[i - 1].End)) { throw new ArgumentException("Invalid attack windows."); } int num = Math.Max(1, (int)Math.Ceiling((tuple.Item2 - tuple.Item1) * 60f)); for (int j = 0; j <= num; j++) { samples.Add(new AttackSample(i, tuple.Item1 + (tuple.Item2 - tuple.Item1) * (float)j / (float)num)); } } } public IReadOnlyList<AttackSample> Advance(double sourceSeconds) { if (double.IsNaN(sourceSeconds) || double.IsInfinity(sourceSeconds) || sourceSeconds < age) { throw new ArgumentOutOfRangeException("sourceSeconds"); } age = sourceSeconds; List<AttackSample> list = new List<AttackSample>(); if (cancelled) { return list; } while (next < samples.Count && (double)samples[next].SourceSeconds <= age) { list.Add(samples[next++]); } return list; } public void Cancel() { cancelled = true; } } public static class Attribution { public const string Acknowledgement = "Jason Asano is inspired by Shirtaloon's He Who Fights with Monsters. Zerneas brought Taka Sasuke to Risk of Rain 2. The body, cloak and native movement and attack animations use Taka assets. Jason's hood, shadow face and violet eyes were created for this mod. Original artwork, animation and mod work belong to their creators. Shedurr's Asuma and the Paladin Alliance contributors are also credited for earlier prototypes and references. HenryMod was originally created by rob and is maintained by TheTimesweeper. Naruto STORM 4 source assets: CyberConnect2 / Bandai Namco Entertainment; Naruto: Masashi Kishimoto. Jason integration, fitting and the star fabric were made with AI assistance under human direction. Full source and tool credits accompany the mod."; } public sealed class CloakCollar { public const int Columns = 88; public const int Rows = 4; public const int SeamColumns = 65; private readonly Vector3[] rest; private readonly Vector3 headRest; private readonly Vector3 shoulderRest; public Vector3[] Vertices { get; } = new Vector3[352]; public CloakCollar(Vector3[] collarRest, Vector3[] capeRest, Vector3[] bindPose) { if (collarRest.Length != 352 || capeRest.Length != 2470 || bindPose.Length != 19) { throw new ArgumentException("Collar seam layout mismatch."); } for (int i = 0; i < 65; i++) { if (Vector3.Distance(collarRest[264 + i], capeRest[i]) > 1E-05f) { throw new ArgumentException("Collar and cloak do not share their attachment boundary."); } } rest = (Vector3[])collarRest.Clone(); headRest = bindPose[4]; shoulderRest = (bindPose[5] + bindPose[8]) * 0.5f; } public void Step(Vector3[] cloth, Vector3[] pose, Quaternion headRotation, Quaternion shoulderRotation) { Vector3 vector = (pose[5] + pose[8]) * 0.5f; for (int i = 0; i < 88; i++) { Vector3 value = pose[4] + Vector3.Transform(rest[i] - headRest, headRotation); Vector3 value2 = ((i < 65) ? cloth[i] : (vector + Vector3.Transform(rest[264 + i] - shoulderRest, shoulderRotation))); for (int j = 0; j < 4; j++) { Vertices[j * 88 + i] = Vector3.Lerp(value, value2, (float)j / 3f); } } } } public static class CloakDrape { public static float Pitch(float torsoDegrees) { if (float.IsNaN(torsoDegrees) || float.IsInfinity(torsoDegrees)) { return 0f; } return (float)Math.Sign(torsoDegrees) * Math.Min(35f, Math.Max(0f, Math.Abs(torsoDegrees) - 25f) * 0.6f); } public static float Roll(float torsoDegrees) { if (float.IsNaN(torsoDegrees) || float.IsInfinity(torsoDegrees)) { return 0f; } return Math.Max(-5f, Math.Min(5f, torsoDegrees * 0.1f)); } } public sealed class CloakMotion { public const int Chains = 9; public const int Links = 7; public const int JointCount = 19; private readonly Vector3[] rest; private readonly Vector3[] restNodes; private readonly Vector3[] nodes = new Vector3[63]; private readonly Vector3[] velocities = new Vector3[63]; private readonly Vector3[] targets = new Vector3[63]; private readonly Vector3[] unconstrained; private readonly Vector3[] shapedRest; private readonly Vector3[] shapedNodes; private readonly Vector3[] contactOffsets; private readonly Vector3[] smoothOffsets; private readonly Vector3[] spatialOffsets; private readonly Quaternion[] frames = new Quaternion[63]; private Quaternion hangingFrame = Quaternion.Identity; private Vector3[]? attachmentBoundary; private readonly int[] indices; private readonly int[] triangles; private readonly int[] activeFaces; private readonly float[] weights; private readonly Vector3 shoulderRest; private Vector3 airflow; private Vector3 lastVelocity; private float falling; private double elapsed; private bool initialized; public Vector3[] Vertices { get; } public ClothCapsule[] Colliders { get; } = new ClothCapsule[14]; public Quaternion DrapeRotation { get; private set; } = Quaternion.Identity; public float Speed => airflow.Length(); public int ResetCount { get; private set; } public void SetAttachmentBoundary(Vector3[] boundary) { if (boundary.Length != 130) { throw new ArgumentException("Expected 65 outer and 65 inner shoulder samples."); } for (int i = 0; i < boundary.Length; i++) { if (!Finite(boundary[i])) { throw new ArgumentException("Nonfinite shoulder sample."); } } if (attachmentBoundary == null) { attachmentBoundary = new Vector3[130]; } Array.Copy(boundary, attachmentBoundary, 130); } public void ClearAttachmentBoundary() { attachmentBoundary = null; } public CloakMotion(Vector3[] vertices, Vector3[] controlPoints, int[] boneIndices, float[] boneWeights, int[] faces, Vector3 restShoulders) { if (vertices.Length != 2470 || controlPoints.Length != 63 || boneIndices.Length != vertices.Length * 4 || boneWeights.Length != boneIndices.Length) { throw new ArgumentException("Cloak geometry/skin layout mismatch."); } rest = (Vector3[])vertices.Clone(); restNodes = (Vector3[])controlPoints.Clone(); shapedRest = new Vector3[rest.Length]; shapedNodes = new Vector3[restNodes.Length]; indices = (int[])boneIndices.Clone(); weights = (float[])boneWeights.Clone(); shoulderRest = restShoulders; triangles = (int[])faces.Clone(); activeFaces = new int[faces.Length / 3]; Vertices = new Vector3[rest.Length]; unconstrained = new Vector3[rest.Length]; contactOffsets = new Vector3[rest.Length / 2]; smoothOffsets = new Vector3[rest.Length / 2]; spatialOffsets = new Vector3[rest.Length / 2]; for (int i = 0; i < indices.Length; i++) { if (indices[i] < 0 || indices[i] >= restNodes.Length || !Finite(weights[i]) || weights[i] < 0f) { throw new ArgumentException("Invalid cloak skin weight."); } } } public bool Step(float dt, Vector3[] pose, Quaternion torso, Vector3 localVelocity, float yawChange, float billow, bool reset = false) { if (pose.Length != 19 || !Finite(dt) || dt < 0f) { return false; } for (int i = 0; i < pose.Length; i++) { if (!Finite(pose[i])) { return false; } } if (Vector3.DistanceSquared(pose[5], pose[8]) < 0.0001f) { return false; } if (!Finite(torso.X) || !Finite(torso.Y) || !Finite(torso.Z) || !Finite(torso.W) || torso.LengthSquared() < 0.1f) { return false; } if (!Finite(localVelocity)) { localVelocity = Vector3.Zero; } float num = Clamp((0f - localVelocity.Y) / 12f, 0f, 1f); localVelocity.Y = 0f; float num2 = localVelocity.Length(); if (num2 > 35f) { localVelocity *= 35f / num2; } if (!Finite(billow)) { billow = 0f; } billow = Clamp(billow, 0f, 0.1f); if (!Finite(yawChange)) { yawChange = 0f; } reset |= !initialized || dt > 0.2f || Math.Abs(yawChange) > 2.5f; if (dt == 0f && !reset) { return true; } float num3 = Math.Min(dt, 0.1f); Vector3 vector = (reset ? Vector3.Zero : Limit(localVelocity - lastVelocity, 8f)); lastVelocity = localVelocity; airflow = (reset ? localVelocity : Vector3.Lerp(airflow, localVelocity, 1f - (float)Math.Exp((0f - num3) / 0.16f))); falling = (reset ? num : (falling + (num - falling) * (1f - (float)Math.Exp((0f - num3) / 0.24f)))); elapsed += num3; Vector3 vector2 = (pose[5] + pose[8]) * 0.5f; Vector3 value = pose[3] - pose[2]; if (value.LengthSquared() < 0.0001f) { return false; } value = Vector3.Normalize(value); float num4 = CloakDrape.Pitch((float)Math.Atan2(value.Z, value.Y) * 180f / MathF.PI) * MathF.PI / 180f; Vector3 vector3 = Vector3.Normalize(pose[8] - pose[5]); Vector3 value2 = Vector3.Cross(vector3, value); value2 = ((!(value2.LengthSquared() < 0.001f)) ? Vector3.Normalize(value2) : Vector3.UnitZ); Vector3 vector4 = Vector3.Normalize(Vector3.Cross(value2, vector3)); Quaternion drapeRotation = Quaternion.CreateFromRotationMatrix(new Matrix4x4(vector3.X, vector3.Y, vector3.Z, 0f, vector4.X, vector4.Y, vector4.Z, 0f, value2.X, value2.Y, value2.Z, 0f, 0f, 0f, 0f, 1f)); DrapeRotation = drapeRotation; Vector3 vector5 = vector3; vector5.Y = 0f; float yaw = (float)Math.Atan2(0f - vector5.Z, vector5.X); hangingFrame = Quaternion.CreateFromYawPitchRoll(yaw, num4 * 0.2f, 0f); BuildColliders(pose); float num5 = Clamp(airflow.Length() / 7f, 0f, 1f); float num6 = Clamp((airflow.Length() - 7f) / 15f, 0f, 1f); Unfurl(num5); Vector3 vector6 = ((airflow.LengthSquared() > 0.0025f) ? (-Vector3.Normalize(airflow)) : (-Vector3.UnitZ)); Vector3 axis = Vector3.Normalize(Vector3.Cross(vector6, Vector3.UnitY)); float num7 = num5 * (1.18f + 0.12f * num6); for (int j = 0; j < 9; j++) { int num8 = j * 7; targets[num8] = ((attachmentBoundary != null) ? attachmentBoundary[j * 8] : (vector2 + Vector3.Transform(restNodes[num8] - shoulderRest, DrapeRotation))); frames[num8] = DrapeRotation; for (int k = 1; k < 7; k++) { int num9 = num8 + k; float num10 = (float)k / 6f; Quaternion value3 = Quaternion.CreateFromAxisAngle(axis, num7 * (0.24f + 0.76f * num10)); Quaternion value4 = Quaternion.Slerp(DrapeRotation, hangingFrame, Clamp((num10 - 0.08f) / 0.22f, 0f, 1f)); frames[num9] = Quaternion.Concatenate(value4, value3); Vector3 vector7 = Vector3.Transform(shapedNodes[num9] - shapedNodes[num9 - 1], frames[num9]); targets[num9] = targets[num9 - 1] + vector7; targets[num9] += new Vector3((float)Math.Sin(elapsed * 0.7 + (double)((float)j * 0.2f)), 0.16f, -0.3f) * billow * num10 * num10 * 0.18f; Vector3 vector8 = Vector3.Transform(Vector3.Normalize(new Vector3(restNodes[num9].X, 0f, restNodes[num9].Z + 0.025f)), hangingFrame); targets[num9] += (vector8 * 0.2f + Vector3.UnitY * 0.2f) * falling * num10 * num10; } for (int l = 1; l < 7; l++) { int num11 = num8 + l; float num12 = (float)l / 6f; Vector3 vector9 = Vector3.Transform(Vector3.Normalize(Vector3.Lerp(new Vector3(restNodes[num11].X, 0f, restNodes[num11].Z + 0.025f), -Vector3.UnitZ, num5)), frames[num11]); float num13 = num5 * (-0.025f + 0.045f * (float)Math.Sin((double)j * 2.15 + 0.7)); float num14 = num5 * 0.16f * (float)Math.Sin(elapsed * 3.8 - (double)(num12 * 6f) + (double)j * 1.1); num14 += falling * 0.055f * (float)Math.Sin(elapsed * 3.1 - (double)(num12 * 5f) + (double)j * 0.83); targets[num11] += vector9 * (num13 + num14) * num12 * num12; targets[num11] += Vector3.UnitY * num5 * 0.026f * (float)Math.Sin(elapsed * 4.1 - (double)(num12 * 7f) + (double)j * 0.67) * num12 * num12; } } if (reset) { Array.Copy(targets, nodes, nodes.Length); Array.Clear(velocities, 0, velocities.Length); initialized = true; ResetCount++; } else { Quaternion rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitY, (0f - Clamp(yawChange, -0.4f, 0.4f)) * 0.65f); for (int m = 0; m < 9; m++) { for (int n = 0; n < 7; n++) { int num15 = m * 7 + n; float num16 = (float)n / 6f; if (n == 0) { nodes[num15] = targets[num15]; velocities[num15] = Vector3.Zero; continue; } nodes[num15] = Vector3.Lerp(nodes[num15], vector2 + Vector3.Transform(nodes[num15] - vector2, rotation), num16); velocities[num15] = Vector3.Transform(velocities[num15], rotation); velocities[num15] -= vector * (0.2f * num16 * num16); float num17 = 16f - 9f * num16; float num18 = 0.72f - 0.12f * num16; float num19 = num18 * num17; float num20 = num17 * (float)Math.Sqrt(1f - num18 * num18); float num21 = (float)Math.Exp((0f - num19) * num3); float num22 = (float)Math.Cos(num20 * num3); float num23 = (float)Math.Sin(num20 * num3) / num20; Vector3 vector10 = nodes[num15] - targets[num15]; Vector3 vector11 = velocities[num15]; nodes[num15] = targets[num15] + num21 * (vector10 * num22 + (vector11 + vector10 * num19) * num23); velocities[num15] = num21 * (vector11 * num22 - (vector11 * num19 + vector10 * num17 * num17) * num23); } } } ConstrainLinks(); int num24 = rest.Length / 2; for (int num25 = 0; num25 < num24; num25++) { Vector3 vector12 = Deform(num25); Vector3 vector13 = Deform(num25 + num24); Vector3 vector14 = (vector12 + vector13) * 0.5f; unconstrained[num25] = vector12; unconstrained[num25 + num24] = vector13; Vector3 vector15 = Limit((Pinned(num25) ? vector14 : Project(vector14, Outward(rest[num25], vector6, num5), 0.022f)) - vector14, ContactLimit(num25)); Vertices[num25] = vector12 + vector15; Vertices[num25 + num24] = vector13 + vector15; } ResolveSurface(vector6, num5, num24); SmoothContacts(num24); float amount = (reset ? 1f : (1f - (float)Math.Exp((0f - num3) / 0.085f))); for (int num26 = 0; num26 < num24; num26++) { Vector3 vector16 = Vertices[num26] - unconstrained[num26]; contactOffsets[num26] = (Pinned(num26) ? Vector3.Zero : (reset ? vector16 : Vector3.Lerp(contactOffsets[num26], vector16, amount))); Vertices[num26] = unconstrained[num26] + contactOffsets[num26]; Vertices[num26 + num24] = unconstrained[num26 + num24] + contactOffsets[num26]; } ResolveSurface(vector6, num5, num24, freeOnly: true, 3); SmoothContacts(num24); ResolveSurface(vector6, num5, num24, freeOnly: true, 3); SpreadContacts(num24); ResolveSurface(vector6, num5, num24, freeOnly: true, 2); for (int num27 = 0; num27 < num24; num27++) { contactOffsets[num27] = Vertices[num27] - unconstrained[num27]; } return true; } private void Unfurl(float run) { for (int i = 0; i < 9; i++) { for (int j = 0; j < 7; j++) { int num = i * 7 + j; shapedNodes[num] = Shape(restNodes[num], (float)i / 8f, (float)j / 6f); } } int num2 = rest.Length / 2; for (int k = 0; k < 19; k++) { for (int l = 0; l < 65; l++) { int num3 = k * 65 + l; float num4 = (float)k / 18f; float num5 = Clamp((num4 - 0.04f) / 0.62f, 0f, 1f); num5 = run * num5 * num5 * (3f - 2f * num5); shapedRest[num3] = Shape(rest[num3], (float)l / 64f, num4); Vector3 vector = Vector3.Normalize(Vector3.Lerp(Vector3.Normalize(rest[num3] - rest[num3 + num2]), -Vector3.UnitZ, num5)); shapedRest[num3 + num2] = shapedRest[num3] - vector * Vector3.Distance(rest[num3], rest[num3 + num2]); } } Vector3 Shape(Vector3 p, float u, float t) { float num6 = Clamp((t - 0.04f) / 0.62f, 0f, 1f); num6 = run * num6 * num6 * (3f - 2f * num6); Vector3 value = new Vector3((1f - 2f * u) * (0.38f + 0.5f * t), 1.635f - 1.345f * t, -0.25f - 0.4f * t); return Vector3.Lerp(p, value, num6); } } private void ConstrainLinks() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 9; j++) { for (int k = 1; k < 7; k++) { int num = ((i % 2 == 0) ? k : (7 - k)); int num2 = j * 7 + num; int num3 = num2 - 1; Vector3 vector = nodes[num2] - nodes[num3]; float num4 = vector.Length(); float num5 = Vector3.Distance(restNodes[num2], restNodes[num3]); float num6 = Clamp(num4, num5 * 0.55f, num5 * 1.1f); if (!(num4 < 0.0001f) && !(Math.Abs(num4 - num6) < 0.0001f)) { Vector3 vector2 = vector * ((num4 - num6) / num4); float num7 = ((num == 1) ? 0f : 0.4f); nodes[num3] += vector2 * num7; nodes[num2] -= vector2 * (1f - num7); velocities[num3] *= 0.9f; velocities[num2] *= 0.9f; } } } } } private void SpreadContacts(int half) { for (int i = 0; i < half; i++) { spatialOffsets[i] = Vertices[i] - unconstrained[i]; } for (int j = 0; j < 5; j++) { Array.Copy(spatialOffsets, smoothOffsets, half); for (int k = 1; k < 19; k++) { for (int l = 0; l < 65; l++) { int i2 = k * 65 + l; Vector3 v = spatialOffsets[i2]; float length = v.Length(); Spread(i2 - 65); if (k + 1 < 19) { Spread(i2 + 65); } if (l > 0) { Spread(i2 - 1); } if (l + 1 < 65) { Spread(i2 + 1); } smoothOffsets[i2] = v; void Spread(int num) { Vector3 vector = spatialOffsets[num]; float num2 = vector.Length(); float num3 = Vector3.Distance(unconstrained[i2], unconstrained[num]); float num4 = num2 - Math.Max(0.012f, num3 * 0.55f); if (!(num4 <= length)) { Vector3 vector2 = ((length > 0.005f) ? (v / length) : (vector / num2)); if (!(Vector3.Dot(vector2, vector) < 0f)) { v = vector2 * num4; length = num4; } } } } } Array.Copy(smoothOffsets, spatialOffsets, half); } for (int m = 0; m < half; m++) { Vertices[m] = unconstrained[m] + spatialOffsets[m]; Vertices[m + half] = unconstrained[m + half] + spatialOffsets[m]; } } private void SmoothContacts(int half) { for (int i = 0; i < half; i++) { spatialOffsets[i] = Vertices[i] - unconstrained[i]; } for (int j = 0; j < 8; j++) { for (int k = 0; k < 19; k++) { for (int l = 0; l < 65; l++) { int num = k * 65 + l; if (k == 0) { smoothOffsets[num] = Vector3.Zero; continue; } Vector3 vector = spatialOffsets[num] * 2f; float num2 = 2f; if (l > 0) { vector += spatialOffsets[num - 1]; num2 += 1f; } if (l + 1 < 65) { vector += spatialOffsets[num + 1]; num2 += 1f; } vector += spatialOffsets[num - 65]; num2 += 1f; if (k + 1 < 19) { vector += spatialOffsets[num + 65]; num2 += 1f; } smoothOffsets[num] = Vector3.Lerp(spatialOffsets[num], vector / num2, 0.7f); } } Array.Copy(smoothOffsets, spatialOffsets, half); } for (int m = 0; m < half; m++) { Vertices[m] = unconstrained[m] + spatialOffsets[m]; Vertices[m + half] = unconstrained[m + half] + spatialOffsets[m]; } } private void ResolveSurface(Vector3 flow, float run, int half, bool freeOnly = false, int passes = 4) { int num = 0; for (int i = 0; i < triangles.Length; i += 3) { if (freeOnly && (rest[triangles[i]].Y > 1.4f || rest[triangles[i + 1]].Y > 1.4f || rest[triangles[i + 2]].Y > 1.4f)) { continue; } Vector3 value = Vertices[triangles[i]]; Vector3 value2 = Vertices[triangles[i + 1]]; Vector3 value3 = Vertices[triangles[i + 2]]; Vector3 vector = Vector3.Min(value, Vector3.Min(value2, value3)); Vector3 vector2 = Vector3.Max(value, Vector3.Max(value2, value3)); ClothCapsule[] colliders = Colliders; for (int j = 0; j < colliders.Length; j++) { ClothCapsule clothCapsule = colliders[j]; Vector3 vector3 = clothCapsule.BoundsMin - new Vector3(0.04f); Vector3 vector4 = clothCapsule.BoundsMax + new Vector3(0.04f); if (vector.X <= vector4.X && vector2.X >= vector3.X && vector.Y <= vector4.Y && vector2.Y >= vector3.Y && vector.Z <= vector4.Z && vector2.Z >= vector3.Z) { activeFaces[num++] = i; break; } } } for (int k = 0; k < passes; k++) { bool touched = false; for (int l = 0; l < half; l++) { if (!Pinned(l) && (!freeOnly || !(rest[l].Y > 1.4f))) { Vector3 vector5 = (Vertices[l] + Vertices[l + half]) * 0.5f; Vector3 change = Project(vector5, Outward(rest[l], flow, run), 0.016f) - vector5; if (!(change.LengthSquared() < 1E-10f)) { MovePair(l, change, half); touched = true; } } } for (int m = 0; m < num; m++) { int num2 = activeFaces[(k % 2 == 0) ? m : (num - 1 - m)]; int a = triangles[num2]; int b = triangles[num2 + 1]; int c = triangles[num2 + 2]; Vector3 vector6 = Vertices[a]; Vector3 vector7 = Vertices[b]; Vector3 vector8 = Vertices[c]; Vector3 vector9 = Vector3.Min(vector6, Vector3.Min(vector7, vector8)); Vector3 vector10 = Vector3.Max(vector6, Vector3.Max(vector7, vector8)); bool flag = false; ClothCapsule[] colliders = Colliders; for (int j = 0; j < colliders.Length; j++) { ClothCapsule clothCapsule2 = colliders[j]; Vector3 vector11 = clothCapsule2.BoundsMin - new Vector3(0.018f); Vector3 vector12 = clothCapsule2.BoundsMax + new Vector3(0.018f); if (vector9.X <= vector12.X && vector10.X >= vector11.X && vector9.Y <= vector12.Y && vector10.Y >= vector11.Y && vector9.Z <= vector12.Z && vector10.Z >= vector11.Z) { flag = true; break; } } Vector3 direction; if (flag) { direction = Outward((rest[a] + rest[b] + rest[c]) / 3f, flow, run); Correct((vector6 + vector7 + vector8) / 3f); Correct((Vertices[a] + Vertices[b]) * 0.5f); Correct((Vertices[b] + Vertices[c]) * 0.5f); Correct((Vertices[c] + Vertices[a]) * 0.5f); } void Correct(Vector3 sample) { Vector3 value4 = Project(sample, direction, 0.012f) - sample; if (!(value4.LengthSquared() < 1E-10f) && (uint)(((!Pinned(a)) ? 1 : 0) + ((!Pinned(b)) ? 1 : 0)) + ((!Pinned(c)) ? 1u : 0u) != 0) { value4 = Limit(value4, 0.08f); Move(a, value4); if (b % half != a % half) { Move(b, value4); } if (c % half != a % half && c % half != b % half) { Move(c, value4); } touched = true; } } } if (!touched) { break; } } void Move(int num3, Vector3 change2) { if (!Pinned(num3)) { MovePair(num3 % half, change2, half); } } } private void MovePair(int i, Vector3 change, int half) { Vector3 vector = Limit(Vertices[i] + change - unconstrained[i], ContactLimit(i)); Vertices[i] = unconstrained[i] + vector; Vertices[i + half] = unconstrained[i + half] + vector; } private static Vector3 Limit(Vector3 value, float maximum) { float num = value.Length(); if (!(num > maximum)) { return value; } return value * (maximum / num); } private float ContactLimit(int vertex) { return 0.4f + 0.15f * Clamp((1f - rest[vertex].Y) / 0.5f, 0f, 1f); } private Vector3 Deform(int vertex) { if (attachmentBoundary != null) { int num = rest.Length / 2; int num2 = vertex % num; if (num2 < 65) { return attachmentBoundary[num2 + ((vertex >= num) ? 65 : 0)]; } } Vector3 zero = Vector3.Zero; int num3 = vertex * 4; for (int i = 0; i < 4; i++) { int num4 = indices[num3 + i]; zero += (nodes[num4] + Vector3.Transform(shapedRest[vertex] - shapedNodes[num4], frames[num4])) * weights[num3 + i]; } return zero; } private bool Pinned(int vertex) { int num = vertex * 4; for (int i = 0; i < 4; i++) { if (weights[num + i] > 1E-05f && indices[num + i] % 7 != 0) { return false; } } return true; } private Vector3 Outward(Vector3 restPoint, Vector3 flow, float run) { return Vector3.Normalize(Vector3.Transform(Vector3.Normalize(new Vector3(restPoint.X, 0f, restPoint.Z + 0.025f)), hangingFrame) + flow * run * 0.35f); } private Vector3 Project(Vector3 p, Vector3 preferred, float gap) { for (int i = 0; i < 4; i++) { bool flag = false; for (int j = 0; j < Colliders.Length; j++) { ClothCapsule clothCapsule = Colliders[j]; if (clothCapsule.MayTouch(p, gap) && !(clothCapsule.Clearance(p) >= gap)) { p = clothCapsule.PushOut(p, preferred, gap); flag = true; } } if (!flag) { break; } } return p; } private void BuildColliders(Vector3[] p) { int k = 0; Add(0, 2, 0.39f, 0.25f); Add(2, 3, 0.48f, 0.26f); Add(5, 6, 0.17f, 0.17f); Add(6, 7, 0.13f, 0.13f); Add(8, 9, 0.17f, 0.17f); Add(9, 10, 0.13f, 0.13f); Add(11, 12, 0.24f, 0.24f); Add(12, 13, 0.19f, 0.19f); Add(15, 16, 0.24f, 0.24f); Add(16, 17, 0.19f, 0.19f); Add(13, 14, 0.16f, 0.16f); Add(17, 18, 0.16f, 0.16f); Colliders[k++] = ClothCapsule.Hand(p[7]); Colliders[k] = ClothCapsule.Hand(p[10]); void Add(int a, int b, float width, float depth) { Colliders[k++] = new ClothCapsule(p[a], p[b], width, depth); } } private static float Clamp(float f, float min, float max) { return Math.Max(min, Math.Min(max, f)); } private static bool Finite(float f) { if (!float.IsNaN(f)) { return !float.IsInfinity(f); } return false; } private static bool Finite(Vector3 v) { if (Finite(v.X) && Finite(v.Y)) { return Finite(v.Z); } return false; } } public readonly struct ClothCapsule { private readonly Vector3 center; private readonly Vector3 scale; private readonly Quaternion inverse; private readonly float cylinder; private readonly float minScale; public readonly Vector3 BoundsMin; public readonly Vector3 BoundsMax; public ClothCapsule(Vector3 a, Vector3 b, float width, float depth) { center = (a + b) * 0.5f; Vector3 vector = Vector3.Normalize(b - a); float num = Vector3.Dot(Vector3.UnitY, vector); Quaternion value = ((num < -0.9999f) ? Quaternion.CreateFromAxisAngle(Vector3.UnitX, MathF.PI) : Quaternion.Normalize(new Quaternion(Vector3.Cross(Vector3.UnitY, vector), 1f + num))); inverse = Quaternion.Conjugate(value); scale = new Vector3(width, Vector3.Distance(a, b) * 0.5f + width * 0.1f, depth); cylinder = 0.5f; minScale = Math.Min(scale.X, Math.Min(scale.Y, scale.Z)); float value2 = Math.Max(scale.X, Math.Max(scale.Y, scale.Z)) * 0.5f; Vector3 vector2 = vector * scale.Y * 0.5f; BoundsMin = Vector3.Min(center - vector2, center + vector2) - new Vector3(value2); BoundsMax = Vector3.Max(center - vector2, center + vector2) + new Vector3(value2); } private ClothCapsule(Vector3 p) { center = p; scale = new Vector3(0.115f); inverse = Quaternion.Identity; cylinder = 0f; minScale = 0.115f; BoundsMin = p - new Vector3(0.0575f); BoundsMax = p + new Vector3(0.0575f); } public static ClothCapsule Hand(Vector3 p) { return new ClothCapsule(p); } private Vector3 Local(Vector3 p) { return Vector3.Transform(p - center, inverse) / scale; } private Vector3 Delta(Vector3 local) { return local - new Vector3(0f, Math.Max(0f - cylinder, Math.Min(cylinder, local.Y)), 0f); } public float Clearance(Vector3 p) { return (Delta(Local(p)).Length() - 0.5f) * minScale; } public bool MayTouch(Vector3 p, float gap) { if (p.X >= BoundsMin.X - gap && p.X <= BoundsMax.X + gap && p.Y >= BoundsMin.Y - gap && p.Y <= BoundsMax.Y + gap && p.Z >= BoundsMin.Z - gap) { return p.Z <= BoundsMax.Z + gap; } return false; } public Vector3 PushOut(Vector3 p, Vector3 direction, float gap) { Vector3 vector = Vector3.Transform(direction, inverse) / scale; float num = 0.5f + gap / minScale; float num2 = vector.LengthSquared(); for (int i = 0; i < 4; i++) { Vector3 vector2 = Delta(Local(p)); float num3 = vector2.LengthSquared(); if (num3 >= num * num) { break; } float num4 = Vector3.Dot(vector2, vector); float num5 = (0f - num4 + (float)Math.Sqrt(Math.Max(0f, num4 * num4 + num2 * (num * num - num3)))) / num2; p += direction * (num5 + 0.0001f); } return p; } } public static class ContractCatalog { private static readonly ContractDefinition[] definitions = new ContractDefinition[100] { new ContractDefinition(1, "Sword Dancer", "Strike four different enemies within eight seconds."), new ContractDefinition(2, "Perfect Form", "Complete three full melee combos without missing an attack."), new ContractDefinition(3, "Death from Above", "Kill three enemies using aerial attacks."), new ContractDefinition(4, "One Against Many", "Hit five enemies with a single sweeping attack."), new ContractDefinition(5, "The Duelist", "Defeat an elite with melee and its automatic on-hit effects. Do not use other damaging abilities."), new ContractDefinition(6, "Relentless Assault", "Maintain 12 consecutive successful melee contacts without taking damage."), new ContractDefinition(7, "Clean Execution", "Finish an enemy using the final strike of Jason's melee combo."), new ContractDefinition(8, "A Moment's Weakness", "Defeat an enemy within five seconds of its attack missing Jason."), new ContractDefinition(9, "Changing Partners", "Alternate attacks between two enemies until both have been defeated."), new ContractDefinition(10, "Death by a Thousand Cuts", "Land 15 separate melee attacks against one sufficiently durable enemy."), new ContractDefinition(11, "Falling Star", "Strike an enemy after descending at least 12 meters."), new ContractDefinition(12, "Never Stop Moving", "Sprint 250 meters and defeat five enemies along the way."), new ContractDefinition(13, "Aerial Supremacy", "Land six attacks without touching the ground."), new ContractDefinition(14, "Hit and Run", "Attack an enemy, retreat at least 20 meters, and return to finish it."), new ContractDefinition(15, "The High Road", "Reach a designated elevated point on the current stage."), new ContractDefinition(16, "Chain Grapple", "Successfully grapple three different targets or surfaces consecutively."), new ContractDefinition(17, "Close the Distance", "Kill a ranged attacker within five seconds of approaching from at least 25 meters away."), new ContractDefinition(18, "Behind You", "Teleport using Path of Shadows and immediately attack an enemy."), new ContractDefinition(19, "Death on the Move", "Kill three enemies without remaining in the same five-meter area for more than three seconds."), new ContractDefinition(20, "The Long Descent", "Defeat an enemy during a controlled glide from an elevated position."), new ContractDefinition(21, "Brink of Death", "Survive for 20 seconds below 25% health while enemies are nearby."), new ContractDefinition(22, "Blood Price", "Lose at least 50% maximum health to enemy attacks, then defeat three enemies without dying."), new ContractDefinition(23, "A Second Wind", "Recover 40% maximum health after falling below 30%."), new ContractDefinition(24, "No Mercy", "Defeat an elite without receiving healing during the encounter."), new ContractDefinition(25, "Outnumbered", "Survive 20 seconds with at least eight enemies within 15 meters."), new ContractDefinition(26, "The Last Laugh", "Kill the enemy responsible for Jason's most recent significant damage."), new ContractDefinition(27, "Pain Is Temporary", "Survive three attacks from an elite, then defeat it."), new ContractDefinition(28, "Against All Odds", "Kill five enemies while remaining below 35% health."), new ContractDefinition(29, "Unbroken", "Kill ten consecutive enemies without taking damage."), new ContractDefinition(30, "A Dangerous Bargain", "Sacrifice health at a Shrine of Blood and defeat an enemy before fully recovering."), new ContractDefinition(31, "The Wanderer", "Discover three widely separated marked locations."), new ContractDefinition(32, "Hidden Riches", "Locate and open a chest inside a designated region."), new ContractDefinition(33, "Treasure Hunter", "Acquire rewards from three different container categories."), new ContractDefinition(34, "Trailblazer", "Reach a randomly selected location at least 100 meters from the player's starting position."), new ContractDefinition(35, "Scavenger", "Break four eligible environmental containers."), new ContractDefinition(36, "Surveyor", "Ping three different categories of interactables."), new ContractDefinition(37, "The Hunt Begins", "Locate a randomly marked enemy."), new ContractDefinition(38, "A Change of Scenery", "Travel between three marked points without teleporting."), new ContractDefinition(39, "Race Against Darkness", "Collect three temporary shadow fragments scattered across a reachable area."), new ContractDefinition(40, "Uncharted Territory", "Locate and approach the teleporter before its encounter begins."), new ContractDefinition(41, "Tempting Fate", "Successfully obtain an item from a Shrine of Chance."), new ContractDefinition(42, "Misfortune's Favorite", "Fail two consecutive Shrine of Chance rolls."), new ContractDefinition(43, "Trial by Combat", "Activate a Shrine of Combat and defeat its summoned enemies."), new ContractDefinition(44, "Sacred Ground", "Activate a Shrine of the Woods and recover health through its effect."), new ContractDefinition(45, "The Mountain Calls", "Activate a Shrine of the Mountain and complete the empowered teleporter encounter."), new ContractDefinition(46, "High Stakes", "Activate two different shrine categories."), new ContractDefinition(47, "The Cost of Power", "Open a Void Cradle and survive the encounter."), new ContractDefinition(48, "Fortune Favors the Bold", "Complete a Shrine of Combat encounter without dropping below half health."), new ContractDefinition(49, "Make an Offering", "Successfully interact with an eligible resource-consuming object, such as a Cleansing Pool."), new ContractDefinition(50, "Shrine Champion", "Complete a shrine-triggered challenge under a temporary combat restriction."), new ContractDefinition(51, "Spendthrift", "Spend a stage-scaled amount of gold."), new ContractDefinition(52, "Frugal Adventurer", "Earn enough gold for a chest and purchase it within ten seconds."), new ContractDefinition(53, "Recycling Day", "Scrap an item and use the scrap in a 3D Printer."), new ContractDefinition(54, "Quality over Quantity", "Acquire an item of a higher tier than the last item collected."), new ContractDefinition(55, "An Unexpected Ally", "Purchase a drone and have it assist in defeating three enemies."), new ContractDefinition(56, "Equipment Specialist", "Successfully activate equipment twice during combat."), new ContractDefinition(57, "Lucky Find", "Obtain an uncommon-or-better item from a freshly opened container."), new ContractDefinition(58, "The Collector", "Acquire three items through three different sources."), new ContractDefinition(59, "Calculated Investment", "Purchase a multishop item and defeat enemies using an eligible effect associated with the purchase."), new ContractDefinition(60, "Fortune's Turn", "Use a 3D Printer and complete a subsequent combat challenge."), new ContractDefinition(61, "Slow Death", "Kill an enemy through affliction damage rather than direct attacks."), new ContractDefinition(62, "Spread the Suffering", "Afflict four enemies simultaneously."), new ContractDefinition(63, "Patient Hunter", "Afflict an enemy and allow the affliction to kill it without further attacks for five seconds."), new ContractDefinition(64, "A Feast of Blood", "Recover a specified amount of health through Blood essence abilities."), new ContractDefinition(65, "Harvest Season", "Successfully affect three valid targets or corpses through Blood Harvest."), new ContractDefinition(66, "Layered Misery", "Maintain multiple distinct afflictions on a durable target simultaneously."), new ContractDefinition(67, "An Unpaid Debt", "Defeat an elite after applying a specified amount of Punition."), new ContractDefinition(68, "Final Judgment", "Successfully use Verdict against an afflicted elite."), new ContractDefinition(69, "The Inexorable End", "Maintain an escalating Doom affliction on a qualifying enemy."), new ContractDefinition(70, "Master of Affliction", "Defeat three enemies using three different unlocked essence attacks."), new ContractDefinition(71, "Shadow Exchange", "Teleport to Shade and defeat an enemy within five seconds."), new ContractDefinition(72, "Two Against One", "Have Jason and Shade both damage the same enemy before it dies."), new ContractDefinition(73, "Dark Reconnaissance", "Send Shade to investigate a marked location."), new ContractDefinition(74, "The Reaper's Grasp", "Gather two enemies through Jason's Reaper power and restrain them for four seconds."), new ContractDefinition(75, "A Loyal Shadow", "Keep a manifested Shade alive for 60 seconds while actively fighting."), new ContractDefinition(76, "Ritual Under Fire", "Complete a familiar summoning ritual with enemies nearby."), new ContractDefinition(77, "Blood Companion", "Have Colin successfully damage or defeat designated enemies."), new ContractDefinition(78, "Guardian of Doom", "Have Gordon's shielding prevent three incoming attacks."), new ContractDefinition(79, "The Perfect Partnership", "Use two familiars to contribute to defeating the same elite."), new ContractDefinition(80, "The Threefold Pact", "Have Shade, Colin, and Gordon all contribute to one combat encounter."), new ContractDefinition(81, "The Cursed Bounty", "An enemy becomes empowered and marked. Hunt it down before its curse expires."), new ContractDefinition(82, "Circle of Judgment", "A glowing circle appears. Remain inside it for 25 seconds while fighting."), new ContractDefinition(83, "The Fugitive", "A designated enemy attempts to escape toward a marked location. Intercept and defeat it."), new ContractDefinition(84, "Blood Contract", "Voluntarily sacrifice 35% health to summon an empowered enemy and defeat it."), new ContractDefinition(85, "The Shadow Chase", "Three temporary shadow apparitions appear in sequence. Reach each before it vanishes."), new ContractDefinition(86, "Doom Approaches", "Nearby enemies receive temporary speed increases. Survive for 40 seconds and defeat a marked target."), new ContractDefinition(87, "The Sealed Blade", "Temporarily disable a selected unlocked active skill and defeat an elite without it."), new ContractDefinition(88, "The Executioner's Trial", "Defeat a marked elite using a specified finishing method."), new ContractDefinition(89, "The Mirror Trial", "Fight an empowered enemy equipped with adapted versions of Jason's abilities."), new ContractDefinition(90, "The Last Stand", "Survive several waves of enemies while restricted to a shrinking battlefield."), new ContractDefinition(91, "Shared Victory", "Jason and an allied player must both damage an elite before its death."), new ContractDefinition(92, "Defender", "Kill three enemies currently targeting a teammate."), new ContractDefinition(93, "Brothers in Arms", "Defeat five enemies while fighting near an ally."), new ContractDefinition(94, "A Timely Rescue", "Defeat an enemy immediately after it significantly damages an ally."), new ContractDefinition(95, "Coordinated Assault", "Two allied players strike the same enemy within two seconds."), new ContractDefinition(96, "Guardian's Duty", "Use a valid defensive power to prevent damage to an ally."), new ContractDefinition(97, "Mutual Sacrifice", "Two players contribute health to a special contract event and survive the encounter."), new ContractDefinition(98, "The Escort", "Keep a purchased drone alive while the team defeats a designated enemy group."), new ContractDefinition(99, "United Front", "Have three allied damage sources contribute to killing a marked elite."), new ContractDefinition(100, "Against the World", "Complete a special enemy wave with every participating teammate surviving.") }; public static IReadOnlyList<ContractDefinition> All => Array.AsReadOnly(definitions); public static ContractDefinition Get(int id) { if (id < 1 || id > 100) { throw new ArgumentOutOfRangeException("id"); } return definitions[id - 1]; } } [Flags] public enum ContractCapability : ulong { None = 0uL, Combat = 1uL, Movement = 2uL, Combo = 4uL, Misses = 8uL, Grapple = 0x10uL, Teleport = 0x20uL, Glide = 0x40uL, Navigation = 0x80uL, Interactions = 0x100uL, Shrines = 0x200uL, Pickups = 0x400uL, Equipment = 0x800uL, Ping = 0x1000uL, Gold = 0x2000uL, Inventory = 0x4000uL, ItemEffects = 0x8000uL, Afflictions = 0x10000uL, Blood = 0x20000uL, Punition = 0x40000uL, Verdict = 0x80000uL, DoomGrowth = 0x100000uL, Shade = 0x200000uL, ShadeDamage = 0x400000uL, Colin = 0x800000uL, Gordon = 0x1000000uL, GordonShield = 0x2000000uL, AllyDefense = 0x4000000uL, Encounters = 0x8000000uL, Sacrifice = 0x10000000uL, Health = 0x20000000uL, Drones = 0x40000000uL, Ritual = 0x80000000uL, All = 0xFFFFFFFFuL } public sealed class ContractAvailability { public ContractCapability Capabilities; public Rank Rank = Rank.Unranked; public int PlayerCount = 1; public int EnemyCount; public int EliteCount; public int DroneCount; public int ChestCount; public int BarrelCount; public int ContainerCategories; public int InteractableCategories; public int DurableEnemies; public int AvailableAfflictions; public int DamageEssences; public int ActiveSkills; public int AlliedSources; public float SecondsAvailable = 180f; public bool SafeStage; public bool Grounded; public bool HasEquipment; public bool HasScrappableItem; public bool HasPrinter; public bool HasMultishopEffect; public bool HasCleansingPool; public bool HasVoidCradle; public bool TeleporterIdle; public bool ActiveEncounter; public readonly HashSet<string> Shrines = new HashSet<string>(); public bool Has(ContractCapability c) { return (Capabilities & c) == c; } } public static class ContractEligibility { public static ContractCapability Needs(int id) { switch (id) { default: throw new ArgumentOutOfRangeException("id"); case 2: case 7: return ContractCapability.Combat | ContractCapability.Combo; case 8: return ContractCapability.Combat | ContractCapability.Misses; case 16: return ContractCapability.Grapple; case 18: case 71: return ContractCapability.Combat | ContractCapability.Teleport | ContractCapability.Shade; case 20: return ContractCapability.Combat | ContractCapability.Glide; case 15: case 31: case 32: case 34: case 37: case 38: case 39: return ContractCapability.Navigation | ContractCapability.Encounters; case 35: return ContractCapability.Interactions; case 36: return ContractCapability.Ping; case 40: return ContractCapability.Navigation; case 41: case 42: case 43: case 44: case 45: case 46: case 48: return ContractCapability.Shrines; case 30: return ContractCapability.Combat | ContractCapability.Shrines | ContractCapability.Health; case 47: return ContractCapability.Combat | ContractCapability.Interactions; case 49: return ContractCapability.Interactions | ContractCapability.Inventory; case 50: return ContractCapability.Shrines | ContractCapability.Encounters; case 51: case 52: return ContractCapability.Interactions | ContractCapability.Gold; case 53: case 60: return ContractCapability.Interactions | ContractCapability.Inventory; case 33: case 54: case 57: return ContractCapability.Pickups; case 58: return ContractCapability.Pickups | ContractCapability.ItemEffects; case 55: return ContractCapability.Combat | ContractCapability.Drones; case 56: return ContractCapability.Equipment; case 59: return ContractCapability.Pickups | ContractCapability.ItemEffects; case 61: case 62: case 63: case 66: case 70: return ContractCapability.Combat | ContractCapability.Afflictions; case 64: case 65: return ContractCapability.Blood; case 67: return ContractCapability.Combat | ContractCapability.Punition; case 68: return ContractCapability.Afflictions | ContractCapability.Verdict; case 69: return ContractCapability.Afflictions | ContractCapability.DoomGrowth; case 72: return ContractCapability.Combat | ContractCapability.ShadeDamage; case 73: return ContractCapability.Navigation | ContractCapability.Shade | ContractCapability.Encounters; case 74: return ContractCapability.Combat | ContractCapability.Grapple; case 75: return ContractCapability.Combat | ContractCapability.Shade; case 76: return ContractCapability.Combat | ContractCapability.Ritual; case 77: return ContractCapability.Combat | ContractCapability.Colin; case 78: return ContractCapability.GordonShield; case 79: return ContractCapability.Combat | ContractCapability.ShadeDamage | ContractCapability.Gordon; case 80: return ContractCapability.Combat | ContractCapability.ShadeDamage | ContractCapability.Colin | ContractCapability.Gordon; case 84: case 97: return ContractCapability.Combat | ContractCapability.Navigation | ContractCapability.Encounters | ContractCapability.Sacrifice; case 96: return ContractCapability.AllyDefense; case 98: return ContractCapability.Encounters | ContractCapability.Drones; case 1: case 3: case 4: case 5: case 6: case 9: case 10: case 11: case 12: case 13: case 14: case 17: case 19: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 91: case 92: case 93: case 94: case 95: case 99: case 100: switch (id) { case 99: case 100: break; case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: return ContractCapability.Combat | ContractCapability.Health; default: return ContractCapability.Combat | ContractCapability.Movement; } break; case 81: case 82: case 83: case 85: case 86: case 87: case 88: case 89: case 90: break; } return ContractCapability.Combat | ContractCapability.Navigation | ContractCapability.Encounters; } public static bool Allows(int id, ContractAvailability world) { ContractDefinition contractDefinition = ContractCatalog.Get(id); if (!world.SafeStage || !world.Has(Needs(id)) || world.Rank < contractDefinition.MinimumRank || world.SecondsAvailable < 60f || (contractDefinition.MultiplayerOnly && world.PlayerCount < 2) || (contractDefinition.Encounter && world.ActiveEncounter)) { return false; } if ((id == 5 || id == 24 || id == 27 || id == 67 || id == 68 || id == 79 || id == 91) && world.EliteCount == 0) { return false; } if ((id == 1 || id == 4 || id == 25) && world.EnemyCount < id switch { 4 => 5, 1 => 4, _ => 8, }) { return false; } if ((id == 32 || id == 52 || id == 57) && world.ChestCount < 1) { return false; } if ((id == 33 && world.ContainerCategories < 3) || (id == 35 && world.BarrelCount < 4) || (id == 36 && world.InteractableCategories < 3)) { return false; } if ((id == 40 && !world.TeleporterIdle) || (id == 47 && !world.HasVoidCradle) || (id == 49 && !world.HasCleansingPool)) { return false; } if ((id == 41 || id == 42) && !world.Shrines.Contains("Chance")) { return false; } if ((id == 43 || id == 48 || id == 50) && !world.Shrines.Contains("Combat")) { return false; } if ((id == 44 && !world.Shrines.Contains("Woods")) || (id == 45 && !world.Shrines.Contains("Mountain")) || (id == 30 && !world.Shrines.Contains("Blood"))) { return false; } if ((id == 46 && world.Shrines.Count < 2) || (id == 45 && !world.TeleporterIdle)) { return false; } if (((id == 53 || id == 60) && (!world.HasPrinter || !world.HasScrappableItem)) || (id == 56 && !world.HasEquipment) || (id == 59 && !world.HasMultishopEffect)) { return false; } if (((id == 55 || id == 98) && world.DroneCount < 1) || (id == 99 && world.AlliedSources < 3)) { return false; } if ((id == 10 || id == 66 || id == 69) && world.DurableEnemies < 1) { return false; } if ((id == 62 && world.EnemyCount < 4) || (id == 66 && world.AvailableAfflictions < 3) || (id == 70 && world.DamageEssences < 3)) { return false; } if ((id == 50 || id == 87) && world.ActiveSkills < 1) { return false; } return true; } public static int[] Available(ContractAvailability world) { return (from d in ContractCatalog.All where Allows(d.Id, world) select d.Id).ToArray(); } } [Flags] public enum ContractFlags : ulong { None = 0uL, Owner = 1uL, Ally = 2uL, Enemy = 4uL, Elite = 8uL, Boss = 0x10uL, Sword = 0x20uL, Affliction = 0x40uL, Airborne = 0x80uL, Sprinting = 0x100uL, Successful = 0x200uL, Finisher = 0x400uL, Shade = 0x800uL, Colin = 0x1000uL, Gordon = 0x2000uL, Equipment = 0x4000uL, FromContainer = 0x8000uL, NoHealing = 0x10000uL, SwordOnly = 0x20000uL, NearbyAlly = 0x40000uL, TargetingAlly = 0x80000uL, Significant = 0x100000uL, Barrier = 0x200000uL, Glide = 0x400000uL, Teleport = 0x800000uL, RestrictionIntact = 0x1000000uL, AllSurvived = 0x2000000uL, Empowered = 0x4000000uL, Marked = 0x8000000uL, ShrineChallenge = 0x10000000uL, GenuineEnemyDamage = 0x20000000uL, Fresh = 0x40000000uL, PaidGold = 0x80000000uL, Player = 0x100000000uL } public enum ContractSignalKind : byte { Tick, SwordHit, Damage, Kill, Heal, Interact, ShrineResult, Item, Equipment, Ping, Teleport, Grapple, Ritual, FamiliarHit, Barrier, AttackMiss, Fragment, Visit, Encounter, Afflictions, Combo, Scrap, Printed, Drone, HealthOffer } public readonly struct ContractPoint { public readonly float X; public readonly float Y; public readonly float Z; public ContractPoint(float x, float y, float z) { X = x; Y = y; Z = z; } public float Distance(ContractPoint p) { float num = X - p.X; float num2 = Y - p.Y; float num3 = Z - p.Z; return (float)Math.Sqrt(num * num + num2 * num2 + num3 * num3); } } public sealed class ContractSignal { public ulong Id; public ulong Actor; public ulong Target; public ulong Attack; public ulong CreditOwner; public ContractSignalKind Kind; public ContractFlags Flags; public float Time; public float Delta; public float Value; public float Value2; public float Health = 1f; public float Distance; public float Height; public int Count; public int ItemTier = -1; public string Category = ""; public string Source = ""; public ContractPoint Position; public ContractSignal Copy() { return (ContractSignal)MemberwiseClone(); } public bool Has(ContractFlags flag) { return (Flags & flag) == flag; } } public sealed class ContractDefinition { public int Id { get; } public string Name { get; } public string Objective { get; } public int Category => (Id - 1) / 10; public int Difficulty { get { if (Id != 90 && Id != 100) { if ((Id < 81 || Id > 90) && Id < 97) { if (Id < 61 && Id != 2 && Id != 5 && Id != 24 && Id != 45 && Id != 48 && Id != 50) { if (Id > 20 && Id > 30 && Id != 56 && Id != 60) { return 0; } return 1; } return 2; } return 3; } return 4; } } public Rank MinimumRank { get { if (Difficulty != 4) { if (Difficulty != 3) { if (Difficulty != 2) { return Rank.Unranked; } return Rank.Iron; } return Rank.Silver; } return Rank.Diamond; } } public bool MultiplayerOnly => Id >= 91; public bool Encounter { get { if (Id != 15 && Id != 31 && Id != 32 && Id != 34 && Id != 37 && Id != 38 && Id != 39 && Id != 47 && Id != 50 && Id != 73 && Id != 77 && (Id < 81 || Id > 90) && Id != 97 && Id != 98 && Id != 99) { return Id == 100; } return true; } } internal ContractDefinition(int id, string name, string objective) { Id = id; Name = name; Objective = objective; } } public sealed class ContractTrial { public readonly HashSet<ulong> BoundTargets = new HashSet<ulong>(); private readonly HashSet<ulong> seen = new HashSet<ulong>(); private readonly HashSet<ulong> distinct = new HashSet<ulong>(); private readonly HashSet<ulong> attacks = new HashSet<ulong>(); private readonly HashSet<string> categories = new HashSet<string>(); private readonly Dictionary<ulong, float> hits = new Dictionary<ulong, float>(); private readonly Dictionary<ulong, float> lastContact = new Dictionary<ulong, float>(); private readonly Dictionary<ulong, float> missed = new Dictionary<ulong, float>(); private readonly Dictionary<ulong, ContractFlags> contributions = new Dictionary<ulong, ContractFlags>(); private readonly Dictionary<ulong, HashSet<ulong>> allies = new Dictionary<ulong, HashSet<ulong>>(); private readonly Queue<(ulong target, float time)> window = new Queue<(ulong, float)>(); private float start = -1f; private float timer; private float amount; private float secondary; private float teleport = -10000f; private float lastDamage = -10000f; private float lastHealth = 1f; private readonly Dictionary<ulong, ulong> lastActors = new Dictionary<ulong, ulong>(); private readonly Dictionary<ulong, HashSet<ulong>> targetAttacks = new Dictionary<ulong, HashSet<ulong>>(); private ContractPoint movementAnchor; private bool hasMovementAnchor; private float lastSprint = -10000f; private ulong lastTarget; private ulong attackKey; private ulong revenge; private int lastTier = -1; private int combos; private bool flag; private bool flag2; private readonly bool variant; private readonly HashSet<ulong> fallenPartners = new HashSet<ulong>(); private ulong pendingPartnerDeath; private float pendingPartnerTime; public ContractDefinition Definition { get; } public ulong Owner { get; } public bool Complete { get; private set; } public float Progress { get; private set; } public float Goal { get; } public ulong BoundTarget { get; set; } public float RequiredAmount { get; set; } = 100f; public string RequiredCategory { get; set; } = ""; public string Status { get; private set; } = ""; public ContractTrial(int definition, ulong owner, bool partyVariant = false, int stage = 1) { if (owner == 0L) { throw new ArgumentOutOfRangeException("owner"); } Definition = ContractCatalog.Get(definition); Owner = owner; int[] array = new int[100] { 4, 3, 3, 5, 1, 12, 1, 1, 2, 15, 1, 5, 6, 1, 1, 3, 1, 1, 3, 1, 20, 3, 40, 1, 20, 1, 4, 5, 10, 1, 3, 1, 3, 1, 4, 3, 1, 3, 3, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 100, 1, 1, 1, 3, 2, 1, 3, 1, 1, 1, 4, 1, 50, 3, 3, 1, 1, 20, 3, 1, 1, 1, 4, 60, 1, 1, 3, 1, 1, 1, 25, 1, 1, 3, 40, 1, 1, 1, 1, 1, 3, 5, 1, 1, 1, 2, 1, 3, 1 }; variant = partyVariant && ContractAudience.For(definition) == Audience.Generalized; Goal = (variant ? ContractAudience.Goal(definition, stage) : array[definition - 1]); } private static bool Finite(float n) { if (!float.IsNaN(n)) { return !float.IsInfinity(n); } return false; } private bool Own(ContractSignal e) { if (e.Actor == Owner) { return e.Has(ContractFlags.Owner); } return false; } private bool Bound(ContractSignal e) { if (BoundTarget == 0L) { if (BoundTargets.Count > 0) { return BoundTargets.Contains(e.Target); } return false; } return e.Target == BoundTarget; } private void Add(float n = 1f) { Progress = Math.Min(Goal, Progress + n); if (Progress >= Goal) { Complete = true; } } private void Set(float n) { Progress = Math.Max(0f, Math.Min(Goal, n)); if (Progress >= Goal) { Complete = true; } } private void Win() { Set(Goal); } private bool Kill(ContractSignal e) { if (e.Kind == ContractSignalKind.Kill && Own(e)) { return e.Has(ContractFlags.Enemy); } return false; } private bool Sword(ContractSignal e) { if (e.Kind == ContractSignalKind.SwordHit && Own(e)) { return e.Has(ContractFlags.Enemy | ContractFlags.Sword); } return false; } private bool Tick(ContractSignal e) { if (e.Kind == ContractSignalKind.Tick) { return Own(e); } return false; } private bool Frame(ContractSignal e) { if (Tick(e) && e.Target == 0L && e.Category == "") { return (e.Flags & (ContractFlags.Shade | ContractFlags.Empowered)) == 0; } return false; } private void ObservePartners(ContractSignal e) { if (e.Target == 0L) { return; } bool flag = Kill(e); if (flag) { pendingPartnerDeath = e.Target; pendingPartnerTime = e.Time; } if ((Sword(e) || (flag && e.Has(ContractFlags.Sword) && !distinct.Contains(e.Target))) && !fallenPartners.Contains(e.Target) && (e.Attack == 0L || !lastActors.TryGetValue(e.Target, out var value) || value != e.Attack)) { bool num = distinct.Count == 2 && !distinct.Contains(e.Target); bool flag2 = lastTarget == e.Target && fallenPartners.Count == 0; if (num || flag2) { distinct.Clear(); fallenPartners.Clear(); lastActors.Clear(); Progress = 0f; } distinct.Add(e.Target); lastTarget = e.Target; lastActors[e.Target] = e.Attack; } if (distinct.Contains(e.Target) && (flag || (Sword(e) && e.Target == pendingPartnerDeath && pendingPartnerTime == e.Time))) { fallenPartners.Add(e.Target); } Set(fallenPartners.Count); if (distinct.Count != 0) { Status = ((fallenPartners.Count == 1) ? "1 down · finish the other partner" : ((distinct.Count == 1) ? "Strike a different enemy" : "Pair marked · alternate while both live")); } } private bool TargetKill(ContractSignal e) { if (Kill(e)) { return Bound(e); } return false; } private bool Source(ContractSignal e, string source) { return e.Source == source; } public bool Observe(ContractSignal e) { if (Complete || e == null || e.CreditOwner != Owner || e.Id == 0L || !Finite(e.Time) || !Finite(e.Delta) || e.Delta < 0f || e.Delta > 1.1f || !Finite(e.Health) || !Finite(e.Value) || !Finite(e.Value2) || !Finite(e.Distance) || !Finite(e.Height) || !seen.Add(e.Id)) { return false; } if (start < 0f) { start = e.Time; } float progress = Progress; bool flag = e.Kind == ContractSignalKind.Damage && e.Target == Owner && e.Has(ContractFlags.GenuineEnemyDamage) && e.Value > 0f; if (flag) { lastDamage = e.Time; if (e.Has(ContractFlags.Significant)) { revenge = e.Actor; } } if (e.Kind == ContractSignalKind.Teleport && Own(e) && e.Has(ContractFlags.Successful)) { teleport = e.Time; } if (variant) { bool flag2 = e.Kind == ContractSignalKind.Damage && Own(e) && e.Has(ContractFlags.Enemy) && e.Value > 0f && e.Category == "PartyDamage"; if ((Definition.Id == 1 && flag2) || (Definition.Id == 7 && Kill(e)) || (Definition.Id == 68 && Kill(e) && e.Has(ContractFlags.Elite))) { Add(); } else if (Definition.Id == 61 && flag2) { Add(e.Value); } else if (Definition.Id == 64 && e.Kind == ContractSignalKind.Heal && e.Target == Owner && e.Value > 0f) { Add(e.Value * 100f); } return progress != Progress; } switch (Definition.Id) { case 1: if (Sword(e)) { window.Enqueue((e.Target, e.Time)); while (window.Count > 0 && e.Time - window.Peek().time > 8f) { window.Dequeue(); } Set(window.Select(((ulong target, float time) x) => x.target).Distinct().Count()); } break; case 2: if (e.Kind == ContractSignalKind.Combo && Own(e)) { if (!e.Has(ContractFlags.Successful)) { combos = 0; Set(0f); } else { combos++; Set(combos); } } break; case 3: if (Kill(e) && e.Has(ContractFlags.Sword | ContractFlags.Airborne)) { Add(); } break; case 4: if (Sword(e) && e.Attack != 0L) { if (attackKey != e.Attack) { attackKey = e.Attack; distinct.Clear(); } distinct.Add(e.Target); Set(distinct.Count); } break; case 5: if (Kill(e) && e.Has(ContractFlags.Elite | ContractFlags.SwordOnly)) { Win(); } break; case 6: if (flag) { Set(0f); } else if (Sword(e)) { Add(); } break; case 7: if (Kill(e) && e.Has(ContractFlags.Sword | ContractFlags.Finisher)) { Win(); } break; case 8: { if (e.Kind == ContractSignalKind.AttackMiss && e.Target == Owner && e.Has(ContractFlags.Enemy)) { missed[e.Actor] = e.Time; } if (Kill(e) && missed.TryGetValue(e.Target, out var value) && e.Time - value <= 5f) { Win(); } break; } case 9: ObservePartners(e); break; case 10: if (Sword(e) && e.Attack != 0L && e.Value2 >= 15f) { if (!targetAttacks.TryGetValue(e.Target, out HashSet<ulong> value12)) { value12 = (targetAttacks[e.Target] = new HashSet<ulong>()); } if (value12.Add(e.Attack)) { hits[e.Target] = (hits.TryGetValue(e.Target, out var value13) ? (value13 + 1f) : 1f); Set(hits[e.Target]); } } break; case 11: if (Sword(e) && e.Height >= 12f) { Win(); } break; case 12: if (Frame(e) && e.Has(ContractFlags.Sprinting) && !e.Has(ContractFlags.Airborne) && e.Distance > 0f) { amount += e.Distance; lastSprint = e.Time; } if (Kill(e) && e.Time - lastSprint <= 3f) { secondary += 1f; } Status = (int)amount + "/250m · " + (int)secondary + "/5 kills"; if (amount >= 250f && secondary >= 5f) { Win(); } else { Progress = Math.Min(4f, secondary); } break; case 13: if (Frame(e) && !e.Has(ContractFlags.Airborne)) { Set(0f); attacks.Clear(); } else if (Sword(e) && e.Has(ContractFlags.Airborne) && e.Attack != 0L && attacks.Add(e.Attack)) { Add(); } break; case 14: { if (Sword(e) && !hits.ContainsKey(e.Target)) { hits[e.Target] = 0f; } if (Tick(e) && e.Target != 0L && e.Distance >= 20f && hits.ContainsKey(e.Target)) { hits[e.Target] = 1f; } if (Kill(e) && hits.TryGetValue(e.Target, out var value16) && value16 > 0f) { Win(); } break; } case 15: if (e.Kind == ContractSignalKind.Visit && Own(e) && Bound(e) && e.Height >= 10f) { Win(); } break; case 16: if (e.Kind != ContractSignalKind.Grapple || !Own(e)) { break; } if (!e.Has(ContractFlags.Successful)) { distinct.Clear(); Set(0f); } else if (e.Target != 0L) { if (!distinct.Add(e.Target)) { distinct.Clear(); distinct.Add(e.Target); } Set(distinct.Count); } break; case 17: { if (Tick(e) && e.Target != 0L && e.Category == "Ranged" && e.Distance >= 25f) { lastContact[e.Target] = e.Time; } if (Kill(e) && e.Category == "Ranged" && lastContact.TryGetValue(e.Target, out var value14) && e.Time - value14 <= 5f) { Win(); } break; } case 18: if (Sword(e) && e.Time - teleport <= 3f) { Win(); } break; case 19: if (Frame(e)) { if (!hasMovementAnchor) { movementAnchor = e.Position; hasMovementAnchor = true; } if (e.Position.Distance(movementAnchor) < 5f) { timer += e.Delta; if (timer > 3f) { Set(0f); } } else { timer = 0f; movementAnchor = e.Position; } } if (Kill(e) && timer <= 3f) { Add(); } break; case 20: if (Kill(e) && e.Has(ContractFlags.Glide) && e.Height >= 10f) { Win(); } break; case 21: if (Frame(e)) { if (e.Health < 0.25f && e.Count > 0) { Add(e.Delta); } else { Set(0f); } } break; case 22: if (flag) { amount += e.Value; } if (Kill(e) && amount >= 0.5f) { Add(); } Status = (int)(amount * 100f) + "/50% health lost · " + (int)Progress + "/3 kills"; break; case 23: if (Frame(e) && e.Health < 0.3f) { this.flag = true; } if (e.Kind == ContractSignalKind.Heal && e.Target == Owner && this.flag && e.Value > 0f) { Add(e.Value * 100f); } break; case 24: if (Kill(e) && e.Has(ContractFlags.Elite | ContractFlags.NoHealing)) { Win(); } break; case 25: if (Frame(e)) { if (e.Count >= 8) { Add(e.Delta); } else { Set(0f); } } break; case 26: if (Kill(e) && revenge != 0L && e.Target == revenge) { Win(); } break; case 27: { if (flag && e.Has(ContractFlags.Elite)) { hits[e.Actor] = (hits.TryGetValue(e.Actor, out var value5) ? (value5 + 1f) : 1f); Progress = Math.Min(3f, hits[e.Actor]); } if (Kill(e) && e.Has(ContractFlags.Elite) && hits.TryGetValue(e.Target, out var value6) && value6 >= 3f) { Win(); } break; } case 28: if (Frame(e) && e.Health >= 0.35f) { Set(0f); } else if (Kill(e) && e.Health < 0.35f) { Add(); } break; case 29: if (flag) { Set(0f); } else if (Kill(e)) { Add(); } break; case 30: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Category == "Blood" && e.Has(ContractFlags.Successful)) { this.flag = true; } if (Frame(e) && e.Health >= 0.999f) { this.flag = false; } if (Kill(e) && this.flag && e.Health < 0.999f) { Win(); } break; case 31: case 38: if (Definition.Id == 38 && e.Kind == ContractSignalKind.Teleport && Own(e)) { distinct.Clear(); Set(0f); } if (e.Kind == ContractSignalKind.Visit && Own(e) && Bound(e) && distinct.Add(e.Target)) { Add(); } break; case 32: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Category == "Chest" && e.Has(ContractFlags.Successful) && Bound(e)) { Win(); } break; case 33: if (e.Kind == ContractSignalKind.Item && Own(e) && e.Has(ContractFlags.FromContainer) && categories.Add(e.Category)) { Add(); } break; case 34: if (e.Kind == ContractSignalKind.Visit && Own(e) && Bound(e) && e.Distance >= 100f) { Win(); } break; case 35: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Category == "Barrel" && e.Has(ContractFlags.Successful) && distinct.Add(e.Target)) { Add(); } break; case 36: if (e.Kind == ContractSignalKind.Ping && Own(e) && e.Target != 0L && e.Category != "" && categories.Add(e.Category)) { Add(); } break; case 37: if (e.Kind == ContractSignalKind.Visit && Own(e) && Bound(e)) { Win(); } break; case 39: case 85: if (e.Kind == ContractSignalKind.Fragment && Own(e) && Bound(e) && e.Has(ContractFlags.Successful) && distinct.Add(e.Target)) { Add(); } break; case 40: if (e.Kind == ContractSignalKind.Visit && Own(e) && e.Category == "TeleporterIdle") { Win(); } break; case 41: if (e.Kind == ContractSignalKind.ShrineResult && Own(e) && e.Category == "Chance" && e.Has(ContractFlags.Successful)) { Win(); } break; case 42: if (e.Kind == ContractSignalKind.ShrineResult && Own(e) && e.Category == "Chance") { if (e.Has(ContractFlags.Successful)) { Set(0f); } else { Add(); } } break; case 43: case 45: case 48: case 50: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Has(ContractFlags.Successful) && e.Category == ((Definition.Id == 45) ? "Mountain" : ((Definition.Id == 50) ? RequiredCategory : "Combat"))) { BoundTarget = e.Target; this.flag = true; } if (Definition.Id == 48 && Tick(e) && this.flag && e.Health < 0.5f) { this.flag2 = true; } if (e.Kind == ContractSignalKind.Encounter && Own(e) && Bound(e) && this.flag && e.Has(ContractFlags.Successful) && (Definition.Id != 48 || !this.flag2) && (Definition.Id != 50 || e.Has(ContractFlags.RestrictionIntact))) { Win(); } break; case 44: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Category == "Woods" && e.Has(ContractFlags.Successful)) { BoundTarget = e.Target; this.flag = true; } if (e.Kind == ContractSignalKind.Heal && e.Target == Owner && this.flag && Source(e, "Woods") && e.Actor == BoundTarget && e.Value > 0f) { Win(); } break; case 46: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Has(ContractFlags.Successful) && e.Source == "Shrine" && categories.Add(e.Category)) { Add(); } break; case 47: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Category == "VoidCradle" && e.Has(ContractFlags.Successful)) { BoundTarget = e.Target; this.flag = true; } if (e.Kind == ContractSignalKind.Encounter && Own(e) && Bound(e) && this.flag && e.Has(ContractFlags.Successful | ContractFlags.AllSurvived)) { Win(); } break; case 49: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Has(ContractFlags.Successful) && e.Category == "Offering" && e.Value > 0f) { Win(); } break; case 51: if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Has(ContractFlags.Successful) && e.Has(ContractFlags.PaidGold) && e.Value > 0f) { amount += e.Value; Set(amount / Math.Max(1f, RequiredAmount) * Goal); } break; case 52: if (Frame(e)) { if (this.flag2 && e.Value >= RequiredAmount && lastHealth < RequiredAmount) { timer = e.Time; this.flag = true; } lastHealth = e.Value; this.flag2 = true; } if (e.Kind == ContractSignalKind.Interact && Own(e) && e.Category == "Chest" && this.flag && e.Time - timer <= 10f && e.Has(ContractFlags.Successful)) { Win(); } break; case 53: if (e.Kind == ContractSignalKind.Scrap && Own(e) && e.Has(ContractFlags.Successful)) { categories.Add(e.Category); } if (e.Kind == ContractSignalKind.Printed && Own(e) && e.Has(ContractFlags.Successful) && e.Source == "Scrap" && categories.Contains(e.Category)) { Win(); } break; case 54: if (e.Kind == ContractSignalKind.Item && Own(e) && e.ItemTier >= 0) { if (lastTier >= 0 && e.ItemTier > lastTier) { Win(); } lastTier = e.ItemTier; } break; case 55: if (e.Kind == ContractSignalKind.Drone && Own(e) && e.Has(ContractFlags.Successful)) { BoundTarget = e.Target; } if (Kill(e) && BoundTarget != 0L && e.Actor == Owner && e.Attack == BoundTarget && distinct.Add(e.Target)) { Add(); } break; case 56: if (e.Kind == ContractSignalKind.Equipment && Own(e) && e.Has(ContractFlags.Successful) && e.Count > 0) { Add(); } break; case 57: if (e.Kind == ContractSignalKind.Item && Own(e) && e.Has(ContractFlags.FromContainer | ContractFlags.Fresh) && e.ItemTier >= 1) { Win(); } break; case 58: if (e.Kind == ContractSignalKind.Item && Own(e) && e.Source != "" && categories.Add(e.Source)) { Add(); } break; case 59: if (e.Kind == ContractSignalKind.Item && Own(e) && Source(e, "Multishop")) { RequiredCategory = e.Category; this.flag = true; } if (Kill(e) && this.flag && Source(e, RequiredCategory)) { Win(); } break; case 60: if (e.Kind == ContractSignalKind.Printed && Own(e) && e.Has(ContractFlags.Successful)) { this.flag = true; } if (Kill(e) && this.flag) { Add(0.2f); } break; case 61: if (Kill(e) && e.Has(ContractFlags.Affliction)) { Win(); } break; case 62: if (e.Kind == ContractSignalKind.Afflictions && Own(e) && e.Category == "SimultaneousTargets" && e.Target == 0L) { Set(e.Count); } break; case 63: { if (e.Kind == ContractSignalKind.Damage && Own(e) && !e.Has(ContractFlags.Affliction)) { lastContact[e.Target] = e.Time; } if (Kill(e) && e.Has(ContractFlags.Affliction) && lastContact.TryGetValue(e.Target, out var value15) && e.Time - value15 >= 5f) { Win(); } break; } case 64: if (e.Kind == ContractSignalKind.Heal && e.Target == Owner && Source(e, "Blood") && e.Value > 0f) { Add(e.Value * 100f); } break; case 65: if (e.Kind == ContractSignalKind.Interact && Own(e) && Source(e, "BloodHarvest") && e.Has(ContractFlags.Successful)) { Add(e.Count); } break; case 66: if (e.Kind == ContractSignalKind.Afflictions && Own(e) && e.Target != 0L && e.Value2 >= 15f) { Set(e.Value); } break; case 67: { if (e.Kind == ContractSignalKind.Damage && Own(e) && Source(e, "Punition") && e.Has(ContractFlags.Elite)) { hits[e.Target] = (hits.TryGetValue(e.Target, out var value7) ? (value7 + e.Value) : e.Value); } if (Kill(e) && e.Has(ContractFlags.Elite) && hits.TryGetValue(e.Target, out var value8) && value8 >= RequiredAmount) { Win(); } break; } case 68: if (e.Kind == ContractSignalKind.Damage && Own(e) && Source(e, "Verdict") && e.Has(ContractFlags.Elite) && e.Count > 0 && e.Value > 0f) { Win(); } break; case 69: if (e.Kind == ContractSignalKind.Afflictions && Own(e) && e.Target != 0L && Source(e, "DoomGrowth") && e.Value2 >= 15f) { if (!lastContact.TryGetValue(e.Target, out var value2) || e.Time - value2 > 1.5f) { hits[e.Target] = e.Time; } lastContact[e.Target] = e.Time; Set(e.Time - hits[e.Target]); } break; case 70: { string text = ((e.Source == "Punition" || e.Source == "Verdict") ? "Doom" : e.Source); if (!Kill(e)) { break; } switch (text) { case "Blood": case "Dark": case "Sin": case "Doom": if (categories.Add(text)) { Add(); } break; } break; } case 71: if (Kill(e) && e.Time - teleport <= 5f) { Win(); } break; case 80: if ((e.Kind == ContractSignalKind.Damage || e.Kind == ContractSignalKind.FamiliarHit) && e.Value > 0f && e.Has(ContractFlags.Enemy)) { if (e.Time - timer > 30f) { attackKey = 0uL; } timer = e.Time; attackKey |= (ulong)(e.Flags & (ContractFlags.Shade | ContractFlags.Colin | ContractFlags.Gordon)); if (attackKey == 14336) { Win(); } } break; case 72: case 79: case 91: case 99: { if ((e.Kind == ContractSignalKind.Damage || e.Kind == ContractSignalKind.FamiliarHit) && e.Value > 0f && e.Has(ContractFlags.Enemy) && (Own(e) || (e.Flags & (ContractFlags.Ally | ContractFlags.Shade | ContractFlags.Colin | ContractFlags.Gordon)) != ContractFlags.None)) { if (Definition.Id == 91 && !e.Has(ContractFlags.Player)) { break; } contributions[e.Target] = (contributions.TryGetValue(e.Target, out var value10) ? value10 : ContractFlags.None) | e.Flags; if (!allies.TryGetValue(e.Target, out HashSet<ulong> value11)) { value11 = (allies[e.Target] = new HashSet<ulong>()); } value11.Add(e.Actor); } if (e.Kind != ContractSignalKind.Kill || !e.Has(ContractFlags.Enemy) || !contributions.TryGetValue(e.Target, out var c)) { break; } bool num; if (Definition.Id != 72) { if (Definition.Id != 79) { if (Definition.Id != 80) { if (Definition.Id != 91) { if (!Bound(e) || allies[e.Target].Count < 3) { break; } num = e.Has(ContractFlags.Elite); } else { if ((c & (ContractFlags.Owner | ContractFlags.Ally)) != (ContractFlags.Owner | ContractFlags.Ally)) { break; } num = e.Has(ContractFlags.Elite); } } else { num = (c & (ContractFlags.Shade | ContractFlags.Colin | ContractFlags.Gordon)) == (ContractFlags.Shade | ContractFlags.Colin | ContractFlags.Gordon); } } else { if (new ContractFlags[3] { ContractFlags.Shade, ContractFlags.Colin, ContractFlags.Gordon }.Count((ContractFlags f) => (c & f) != 0) < 2) { break; } num = e.Has(ContractFlags.Elite); } } else { num = (c & (ContractFlags.Owner | ContractFlags.Shade)) == (ContractFlags.Owner | ContractFlags.Shade); } if (num) { Win(); } break; } case 73: if (e.Kind == ContractSignalKind.Visit && e.Has(ContractFlags.Shade) && Bound(e)) { Win(); } break; case 74: if (Tick(e) && e.Category == "ReaperBind") { if (e.Count >= 2) { Add(e.Delta); } else { Set(0f); } } break; case 75: if (Tick(e) && e.Has(ContractFlags.Shade) && e.Count > 0 && e.Value > 0f) { Add(e.Delta); } break; case 76: if (e.Kind == ContractSignalKind.Ritual && Own(e) && e.Has(ContractFlags.Successful) && e.Count > 0) { Win(); } break; case 77: if (e.Kind == ContractSignalKind.FamiliarHit && e.Has(ContractFlags.Colin) && Bound(e) && e.Value > 0f) { Win(); } break; case 78: if (e.Kind == ContractSignalKind.Barrier && Own(e) && e.Has(ContractFlags.Gordon) && e.Value > 0f) { Add(); } break; case 81: if (TargetKill(e) && e.Has(ContractFlags.Empowered)) { Win(); } break; case 82: if (Tick(e) && Bound(e)) { if (e.Distance <= RequiredAmount && e.Count > 0) { Add(e.Delta); } else { Set(0f); } } break; case 83: if (TargetKill(e) && e.Has(ContractFlags.Successful)) { Win(); } break; case 84: if (e.Kind == ContractSignalKind.HealthOffer && Own(e) && e.Value >= 0.35f && Bound(e) && e.Has(ContractFlags.Successful)) { this.flag = true; } if (TargetKill(e) && this.flag && e.Has(ContractFlags.Empowered)) { Win(); } break; case 86: if (Tick(e) && e.Has(ContractFlags.Empowered) && e.Count > 0) { timer += e.Delta; } if (TargetKill(e)) { this.flag = true; } Progress = Math.Min(Goal - 1f, timer); if (timer >= 40f && this.flag) { Win(); } break; case 87: if (TargetKill(e) && e.Has(ContractFlags.Elite | ContractFlags.RestrictionIntact)) { Win(); } break; case 88: if (TargetKill(e) && e.Source == RequiredCategory) { Win(); } break; case 89: if (TargetKill(e) && Source(e, "Mirror")) { Win(); } break; case 90: case 100: if (e.Kind == ContractSignalKind.Encounter && Own(e) && Bound(e) && e.Has(ContractFlags.Successful) && (Definition.Id != 100 || e.Has(ContractFlags.AllSurvived))) { Win(); } break; case 92: if (Kill(e) && e.Has(ContractFlags.TargetingAlly)) { Add(); } break; case 93: if (Kill(e) && e.Has(ContractFlags.NearbyAlly)) { Add(); } break; case 94: { if (e.Kind == ContractSignalKind.Damage && e.Has(ContractFlags.Ally | ContractFlags.Significant | ContractFlags.GenuineEnemyDamage)) { missed[e.Actor] = e.Time; } if (Kill(e) && missed.TryGetValue(e.Target, out var value9) && e.Time - value9 <= 5f) { Win(); } break; } case 95: if (e.Kind == ContractSignalKind.Damage && e.Has(ContractFlags.Enemy | ContractFlags.Player) && e.Value > 0f && (Own(e) || e.Has(ContractFlags.Ally))) { if (lastContact.TryGetValue(e.Target, out var value3) && e.Time - value3 <= 2f && lastActors.TryGetValue(e.Target, out var value4) && value4 != e.Actor) { Win(); } lastContact[e.Target] = e.Time; lastActors[e.Target] = e.Actor; } break; case 96: if (e.Kind == ContractSignalKind.Barrier && Own(e) && e.Has(ContractFlags.Ally) && e.Value > 0f) { Win(); } break; case 97: if (e.Kind == ContractSignalKind.HealthOffer && Bound(e) && e.Has(ContractFlags.Successful) && (Own(e) || e.Has(ContractFlags.Ally)) && e.Value > 0f) { distinct.Add(e.Actor); } if (e.Kind == ContractSignalKind.Encounter && Own(e) && Bound(e) && distinct.Count >= 2 && e.Has(ContractFlags.Successful | ContractFlags.AllSurvived)) { Win(); } break; case 98: if (e.Kind == ContractSignalKind.Encounter && Own(e) && Bound(e) && e.Has(ContractFlags.Successful | ContractFlags.AllSurvived) && e.Category == "DroneEscort") { Win(); } break; } if (!Complete) { return Progress != progress; } return true; } } public static class DoomPlunge { public const float Windup = 0.18f; public const float MaximumDescent = 0.95f; public const float Recovery = 0.3f; public const float Speed = 32f; public const float DownwardThreshold = -0.57357645f; public static bool CanStart(bool grounded, bool used, bool active, float aimY) { if (!grounded && !used && !active && !float.IsNaN(aimY)) { return aimY <= -0.57357645f; } return false; } public static Vector3 Direction(Vector3 aim) { if (!Finite(aim) || aim.LengthSquared() < 0.0001f) { return -Vector3.UnitY; } aim = Vector3.Normalize(aim); if (aim.Y > -0.57357645f) { Vector3 value = new Vector3(aim.X, 0f, aim.Z); if (value.LengthSquared() < 0.0001f) { return -Vector3.UnitY; } aim = Vector3.Normalize(value) * 0.81915206f + Vector3.UnitY * -0.57357645f; } return Vector3.Normalize(aim); } public static bool Finite(Vector3 v) { if (!float.IsNaN(v.X) && !float.IsInfinity(v.X) && !float.IsNaN(v.Y) && !float.IsInfinity(v.Y) && !float.IsNaN(v.Z)) { return !float.IsInfinity(v.Z); } return false; } public static Vector3 Elbow(Vector3 shoulder, Vector3 target, Vector3 originalElbow, Vector3 fallbackPole, float upperLength, float foreLength) { Vector3 vector = target - shoulder; float num = Math.Max(0.001f, vector.Length()); Vector3 vector2 = vector / num; num = Math.Min(num, upperLength + foreLength - 0.0001f); num = Math.Max(num, Math.Abs(upperLength - foreLength) + 0.0001f); Vector3 vector3 = originalElbow - shoulder; vector3 -= vector2 * Vector3.Dot(vector3, vector2); if (vector3.LengthSquared() < 1E-05f) { vector3 = fallbackPole - vector2 * Vector3.Dot(fallbackPole, vector2); } if (vector3.LengthSquared() < 1E-05f) { vector3 = Vector3.Cross(vector2, (Math.Abs(vector2.Y) < 0.9f) ? Vector3.UnitY : Vector3.UnitX); } vector3 = Vector3.Normalize(vector3); float num2 = (upperLength * upperLength - foreLength * foreLength + num * num) / (2f * num); float num3 = (float)Math.Sqrt(Math.Max(0f, upperLength * upperLength - num2 * num2)); return shoulder + vector2 * num2 + vector3 * num3; } } public readonly struct DoomPower { public Rank Rank { get; } public int Step => (int)(Rank + 1); public float GrowthInterval { get { if (Rank < Rank.Gold) { return Math.Max(3f, 8f - (float)Step); } return 2f; } } public float PunitionCooldown { get { if (Rank < Rank.Gold) { if (Rank < Rank.Silver) { return 30f; } return 20f; } return 40f; } } public float PunitionRadius { get { if (Rank < Rank.Gold) { return 0f; } return 12f; } } public float VerdictCooldown => 120f; public float VerdictRadius { get { if (Rank < Rank.Gold) { return 0f; } return 8f; } } public float Range => 60f; public float RuinationTick => 0.04f + 0.008f * (float)Step; public int Orbs => 4 + 2 * Step; public float RayCooldown => 2.5f; internal DoomPower(Rank rank) { Rank = rank; } public float PunitionCoefficient(int conditions) { return Math.Min(40f, 1f + (float)Math.Clamp(conditions, 0, 16) * (0.8f + 0.15f * (float)Step)); } public float VerdictCoefficient(float healthFraction, int legacy) { if (float.IsNaN(healthFraction) || float.IsInfinity(healthFraction)) { return 0f; } float num = 1f - Math.Clamp(healthFraction, 0f, 1f); retur
plugins/Jason.RoR2.dll
Decompiled 9 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.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Numerics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using EntityStates; using EntityStates.GolemMonster; using HG.Reflection; using HarmonyLib; using KinematicCharacterController; using Microsoft.CodeAnalysis; using R2API; using R2API.Utils; using Rewired; using RoR2; using RoR2.CharacterAI; using RoR2.Navigation; using RoR2.Skills; using RoR2.UI; using Sapherno.Jason.Core; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Jason.RoR2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("Jason.RoR2")] [assembly: AssemblyTitle("Jason.RoR2")] [assembly: AssemblyMetadata("ProjectSteward", "Sapherno")] [assembly: AssemblyMetadata("ReuseTerms", "Free fan mod. Original work requires explicit permission for redistribution, subject to applicable law and existing licenses. No sales or paywalls. See RIGHTS-NOTICE.md.")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Sapherno.Jason.Integration { internal static class BeamSurface { internal static Material Create(GameObject parent, string name) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown GameObject val = new GameObject("Sprite material source"); val.transform.SetParent(parent.transform, false); Material val2 = new Material(((Renderer)val.AddComponent<SpriteRenderer>()).sharedMaterial) { name = name }; Object.DestroyImmediate((Object)(object)val); return val2; } } internal readonly struct CeremonialGripFit { internal const float Span = 0.35f; internal readonly Vector3 ForearmBase; internal readonly Quaternion Rotation; internal readonly float Scale; internal CeremonialGripFit(List<Vector3> points) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) if (points.Count < 3) { throw new ArgumentException("Empty equipped display"); } Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(points[0], Vector3.zero); foreach (Vector3 point in points) { ((Bounds)(ref val)).Encapsulate(point); } float y = ((Bounds)(ref val)).size.y; if (!(y > 1E-05f)) { throw new ArgumentException("Equipped display has no height"); } Vector3 val2 = Vector3.zero; int num = 0; foreach (Vector3 point2 in points) { if (point2.y <= ((Bounds)(ref val)).min.y + y * 0.055f) { val2 += point2; num++; } } ForearmBase = new Vector3(val2.x / (float)num, ((Bounds)(ref val)).min.y, val2.z / (float)num); Vector3 val3 = Vector3.zero; float num2 = 0f; foreach (Vector3 point3 in points) { Vector3 val4 = Vector3.ProjectOnPlane(point3 - ForearmBase, Vector3.up); if (((Vector3)(ref val4)).sqrMagnitude > ((Vector3)(ref val3)).sqrMagnitude) { val3 = val4; } float num3 = num2; Vector3 val5 = point3 - ForearmBase; num2 = Mathf.Max(num3, ((Vector3)(ref val5)).magnitude); } if (!(num2 > 1E-05f) || ((Vector3)(ref val3)).sqrMagnitude < 1E-12f) { throw new ArgumentException("Equipped display has no blade extent"); } Rotation = Quaternion.Inverse(Quaternion.LookRotation(Vector3.Cross(((Vector3)(ref val3)).normalized, Vector3.up), Vector3.up)); Scale = 0.35f / num2; } } internal static class CeremonialHand { private static GameObject? template; private static float nextAttempt; private static bool warned; private static readonly List<Mesh> ownedMeshes = new List<Mesh>(); private static AsyncOperationHandle<GameObject>? retainedDisplay; private static Mesh? upperArm; internal static bool Available() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)template)) { return true; } if (Time.unscaledTime < nextAttempt || !Object.op_Implicit((Object)(object)Items.Dagger) || (int)Items.Dagger.itemIndex == -1) { return false; } nextAttempt = Time.unscaledTime + 5f; string text = "native rules unavailable"; string[] array = new string[2] { "HuntressBody", "CommandoBody" }; foreach (string bodyName in array) { try { if (Resolve(bodyName)) { return true; } } catch (Exception ex) { text = ex.Message; } } if (!warned) { JasonPlugin.Warning("Cloak grip unavailable (" + text + "). Will retry while hands are visible."); } warned = true; return false; } private static bool Resolve(string bodyName) { //IL_0197: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) GameObject val = BodyCatalog.FindBodyPrefab(bodyName); ModelLocator val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ModelLocator>() : null); if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.modelTransform)) { return false; } CharacterModel component = ((Component)val2.modelTransform).GetComponent<CharacterModel>(); ChildLocator component2 = ((Component)val2.modelTransform).GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.itemDisplayRuleSet) || !Object.op_Implicit((Object)(object)component2)) { return false; } ItemDisplayRule[] rules = component.itemDisplayRuleSet.GetItemDisplayRuleGroup(Items.Dagger.itemIndex).rules; if (rules == null) { return false; } ItemDisplayRule[] array = rules; foreach (ItemDisplayRule val3 in array) { if ((int)val3.ruleType != 0) { continue; } Transform val4 = component2.FindChild(val3.childName); if (!Object.op_Implicit((Object)(object)val4)) { continue; } GameObject val5 = val3.followerPrefab; AsyncOperationHandle<GameObject>? val6 = null; try { if (!Object.op_Implicit((Object)(object)val5) && val3.followerPrefabAddress != null && ((AssetReference)val3.followerPrefabAddress).RuntimeKeyIsValid()) { val6 = Addressables.LoadAssetAsync<GameObject>(((AssetReference)val3.followerPrefabAddress).RuntimeKey); val5 = val6.Value.WaitForCompletion(); } if (!Object.op_Implicit((Object)(object)val5)) { continue; } Quaternion pose = Quaternion.Inverse(val.transform.rotation) * val4.rotation * Quaternion.Euler(val3.localAngles); Build(val5, pose, Vector3.Scale(val4.lossyScale, val3.localScale)); retainedDisplay = val6; val6 = null; return true; } finally { if (val6.HasValue) { Addressables.Release<GameObject>(val6.Value); } } } return false; } private static void Build(GameObject display, Quaternion pose, Vector3 size) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0023: 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_0058: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Expected O, but got Unknown GameObject val = new GameObject("Jason fitted Ceremonial Dagger"); val.SetActive(false); List<Mesh> list = new List<Mesh>(); try { Transform transform = new GameObject("Equipped pose").transform; transform.SetParent(val.transform, false); Transform transform2 = new GameObject(((Object)display).name).transform; transform2.SetParent(transform, false); transform2.localRotation = pose; transform2.localScale = size; Dictionary<Transform, Transform> hierarchy = new Dictionary<Transform, Transform> { [display.transform] = transform2 }; List<Vector3> list2 = new List<Vector3>(); List<(Renderer, Mesh, Transform, Vector3[])> list3 = new List<(Renderer, Mesh, Transform, Vector3[])>(); Renderer[] componentsInChildren = display.GetComponentsInChildren<Renderer>(true); MeshFilter val6 = default(MeshFilter); Matrix4x4 localToWorldMatrix; foreach (Renderer val2 in componentsInChildren) { bool flag = true; Transform val3 = ((Component)val2).transform; while ((Object)(object)val3 != (Object)(object)display.transform) { if (!((Component)val3).gameObject.activeSelf) { flag = false; break; } val3 = val3.parent; } if (!flag) { continue; } SkinnedMeshRenderer val4 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); Mesh val5; if (val4 != null && Object.op_Implicit((Object)(object)val4.sharedMesh)) { val5 = new Mesh { name = ((Object)val4.sharedMesh).name + " (equipped pose)" }; list.Add(val5); val4.BakeMesh(val5); } else { if (!(val2 is MeshRenderer) || !((Component)val2).TryGetComponent<MeshFilter>(ref val6)) { continue; } val5 = val6.sharedMesh; } if (Object.op_Implicit((Object)(object)val5) && val5.vertexCount != 0) { Transform val7 = CopyPath(((Component)val2).transform); Vector3[] array = Vertices(val5); for (int j = 0; j < array.Length; j++) { int num = j; localToWorldMatrix = val7.localToWorldMatrix; array[num] = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(array[j]); } list2.AddRange(array); list3.Add((val2, val5, val7, array)); } } CeremonialGripFit fit = new CeremonialGripFit(list2); CloakGripPartition cloakGripPartition = new CloakGripPartition(list2.ConvertAll(FitPoint)); CloakFabricMesh cloakFabricMesh = new CloakFabricMesh(); List<Vector3> list4 = new List<Vector3>(); List<Vector3> list5 = new List<Vector3>(); int num2 = 0; int num3 = 0; foreach (var item4 in list3) { Mesh item = item4.Item2; Renderer item2 = item4.Item1; Transform item3 = item4.Item3; Vector3[] array2 = Array.ConvertAll(item4.Item4, FitPoint); int[][] array3 = CloakWeaponMesh.ReadTriangles(item); List<int>[] array4 = new List<int>[array3.Length]; List<int> list6 = new List<int>(); int num4 = 0; for (int k = 0; k < array3.Length; k++) { array4[k] = new List<int>(); cloakGripPartition.Split(array2, array3[k], list6, array4[k]); num4 += array4[k].Count; foreach (int item5 in array4[k]) { list5.Add(array2[item5]); } } localToWorldMatrix = item3.localToWorldMatrix; if (((Matrix4x4)(ref localToWorldMatrix)).determinant < 0f) { for (int l = 0; l < list6.Count; l += 3) { int value = list6[l + 1]; list6[l + 1] = list6[l + 2]; list6[l + 2] = value; } } foreach (int item6 in list6) { list4.Add(array2[item6]); } cloakFabricMesh.Add(array2, list6, sleeve: false); num2 += list6.Count / 3; num3 += num4 / 3; if (num4 == 0) { continue; } Mesh val8 = item; if (list6.Count > 0) { val8 = CloakWeaponMesh.CopyFaces(item, array4); list.Add(val8); } ((Component)item3).gameObject.AddComponent<MeshFilter>().sharedMesh = val8; MeshRenderer val9 = ((Component)item3).gameObject.AddComponent<MeshRenderer>(); ((Renderer)val9).sharedMaterials = item2.sharedMaterials; ((Renderer)val9).shadowCastingMode = item2.shadowCastingMode; ((Renderer)val9).receiveShadows = item2.receiveShadows; MaterialPropertyBlock val10 = new MaterialPropertyBlock(); item2.GetPropertyBlock(val10); if (!val10.isEmpty) { ((Renderer)val9).SetPropertyBlock(val10); } for (int m = 0; m < ((Renderer)val9).sharedMaterials.Length; m++) { item2.GetPropertyBlock(val10, m); if (!val10.isEmpty) { ((Renderer)val9).SetPropertyBlock(val10, m); } } } if (num2 == 0 || num3 == 0) { throw new InvalidOperationException("Cannot distinguish native hand from dagger"); } Mesh val11 = cloakFabricMesh.Build("Jason cloak forearm and fingers"); list.Add(val11); val.AddComponent<MeshFilter>().sharedMesh = val11; val.AddComponent<MeshRenderer>(); transform.localScale = Vector3.one * fit.Scale; transform.localRotation = fit.Rotation; transform.localPosition = -(fit.Rotation * fit.ForearmBase) * fit.Scale; CloakDoomFit cloakDoomFit = new CloakDoomFit(list5, list4); Transform transform4 = new GameObject("Blade of Doom socket").transform; transform4.SetParent(val.transform, false); transform4.localPosition = cloakDoomFit.Origin; transform4.localRotation = cloakDoomFit.Rotation; transform4.localScale = Vector3.one * cloakDoomFit.Scale; ((Component)transform4).gameObject.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); ownedMeshes.AddRange(list); template = val; JasonPlugin.Log("Fitted native cloak grip " + ((Object)display).name + " using " + list2.Count + " vertices, " + num2 + " cloth faces and " + num3 + " dagger faces."); Transform CopyPath(Transform source) { //IL_0018: 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_0044: 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) if (hierarchy.TryGetValue(source, out Transform value2)) { return value2; } value2 = new GameObject(((Object)source).name).transform; value2.SetParent(CopyPath(source.parent), false); value2.localPosition = source.localPosition; value2.localRotation = source.localRotation; value2.localScale = source.localScale; hierarchy.Add(source, value2); return value2; } Vector3 FitPoint(Vector3 v) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) return fit.Rotation * (v - fit.ForearmBase) * fit.Scale; } } catch { Object.Destroy((Object)(object)val); foreach (Mesh item7 in list) { Object.Destroy((Object)(object)item7); } throw; } } private unsafe static Vector3[] Vertices(Mesh mesh) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //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) if (mesh.isReadable) { return mesh.vertices; } int vertexAttributeStream = mesh.GetVertexAttributeStream((VertexAttribute)0); int vertexAttributeOffset = mesh.GetVertexAttributeOffset((VertexAttribute)0); int vertexBufferStride = mesh.GetVertexBufferStride(vertexAttributeStream); VertexAttributeFormat vertexAttributeFormat = mesh.GetVertexAttributeFormat((VertexAttribute)0); int width = (((int)vertexAttributeFormat == 0) ? 4 : (((int)vertexAttributeFormat == 1) ? 2 : 0)); if (width == 0 || mesh.GetVertexAttributeDimension((VertexAttribute)0) < 3) { throw new InvalidOperationException("Unsupported grip vertex layout " + ((object)(*(VertexAttributeFormat*)(&vertexAttributeFormat))/*cast due to .constrained prefix*/).ToString()); } byte[] data = new byte[checked(vertexBufferStride * mesh.vertexCount)]; GraphicsBuffer vertexBuffer = mesh.GetVertexBuffer(vertexAttributeStream); try { vertexBuffer.GetData((Array)data); } finally { ((IDisposable)vertexBuffer)?.Dispose(); } Vector3[] array = (Vector3[])(object)new Vector3[mesh.vertexCount]; for (int i = 0; i < array.Length; i++) { int num = i * vertexBufferStride + vertexAttributeOffset; array[i] = new Vector3(Read(num), Read(num + width), Read(num + width * 2)); } return array; float Read(int startIndex) { if (width != 4) { return Mathf.HalfToFloat(BitConverter.ToUInt16(data, startIndex)); } return BitConverter.ToSingle(data, startIndex); } } internal static MountedCloakArm Create(Transform parent, SkinnedMeshRenderer sleeve) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)upperArm)) { upperArm = MountedCloakArm.CopySleeve(sleeve); ownedMeshes.Add(upperArm); } Transform transform = new GameObject("Jason cloak arm").transform; transform.SetParent(parent, false); return new MountedCloakArm(transform, upperArm, CreateGrip(transform)); } private static Transform CreateGrip(Transform parent) { GameObject obj = Object.Instantiate<GameObject>(template, parent, false); obj.SetActive(true); return obj.transform; } internal static void Release() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)template)) { Object.Destroy((Object)(object)template); } template = null; upperArm = null; foreach (Mesh ownedMesh in ownedMeshes) { Object.Destroy((Object)(object)ownedMesh); } ownedMeshes.Clear(); if (retainedDisplay.HasValue) { Addressables.Release<GameObject>(retainedDisplay.Value); } retainedDisplay = null; nextAttempt = 0f; warned = false; } } internal sealed class ProgressionPacket : MessageBase { internal float ChantReceivedAt; internal uint Master; internal uint RunNetwork; internal uint CasterBody; internal string Run = ""; internal ulong Serial; internal ulong Revision; internal int Bosses; internal byte Owned; internal uint Awakened; internal readonly ulong[] MissionIds = new ulong[5]; internal readonly string[] MissionTitles = new string[5] { "", "", "", "", "" }; internal string Notice = ""; internal ulong NoticeSequence; internal readonly string[] Missions = new string[5]; internal readonly float[] Cooldowns = new float[20]; internal ContractBeacon[] Beacons = Array.Empty<ContractBeacon>(); internal FamiliarMode ShadeMode; internal int ShadeRemaining; internal int ShadeRank = -2; internal float RitualElapsed; internal Vector3 RitualOrigin; internal uint[] ShadeActors = Array.Empty<uint>(); internal FamiliarMode ColinMode; internal int ColinRemaining; internal int ColinDeployed; internal float ColinElapsed; internal Vector3 ColinOrigin; internal bool Amulet; internal bool PhoenixReady; internal int Blessings; internal FamiliarMode GordonMode; internal int GordonRemaining; internal int GordonRank = -2; internal float GordonElapsed; internal Vector3 GordonOrigin; internal uint GordonActor; internal bool Ranking; internal uint Leader; internal int Amount; internal int Reserve; internal byte Permanent; internal byte[] Status = new byte[5]; internal byte[] Order = new byte[4] { 1, 2, 4, 8 }; internal uint[] Invitations = Array.Empty<uint>(); internal uint[] Membership = Array.Empty<uint>(); internal uint[] InvitationTickets = Array.Empty<uint>(); internal int ColinSecondsLeft => (int)Math.Ceiling(Math.Max(0.0, 20.0 - (double)ColinElapsed)); internal bool HasFreshChant(uint bodyId, float now) { if (bodyId != 0 && CasterBody == bodyId) { return now - ChantReceivedAt <= 3f; } return false; } internal EssenceSnapshot Snapshot() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown return new EssenceSnapshot(Guid.ParseExact(Run, "N"), Revision, Bosses, (Essence)Owned, Awakened); } internal static ProgressionPacket From(JasonProgressionRuntime.PlayerState p) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) EssenceSnapshot val = p.Progress.Snapshot(); ProgressionPacket progressionPacket = new ProgressionPacket(); NetworkInstanceId netId = ((NetworkBehaviour)p.Master).netId; progressionPacket.Master = ((NetworkInstanceId)(ref netId)).Value; netId = ((NetworkBehaviour)Run.instance).netId; progressionPacket.RunNetwork = ((NetworkInstanceId)(ref netId)).Value; progressionPacket.Run = val.RunId.ToString("N"); progressionPacket.Serial = ++JasonProgressionRuntime.Instance.SnapshotSequence; progressionPacket.Revision = val.Revision; progressionPacket.Bosses = val.BossKills; progressionPacket.Owned = (byte)val.Owned; progressionPacket.Awakened = val.Awakened; progressionPacket.Notice = p.Notice; progressionPacket.NoticeSequence = p.NoticeSequence; ProgressionPacket progressionPacket2 = progressionPacket; progressionPacket2.Beacons = p.Contracts.Beacons.Concat(JasonProgressionRuntime.Instance.Players.Values.Where((JasonProgressionRuntime.PlayerState other) => other != p).SelectMany((JasonProgressionRuntime.PlayerState other) => other.Contracts.Beacons.Where((ContractBeacon b) => b.Shared))).Take(16).ToArray(); CharacterBody body = p.Master.GetBody(); int casterBody; if (!Object.op_Implicit((Object)(object)body)) { casterBody = 0; } else { netId = ((NetworkBehaviour)body).netId; casterBody = (int)((NetworkInstanceId)(ref netId)).Value; } progressionPacket2.CasterBody = (uint)casterBody; progressionPacket2.ChantReceivedAt = Time.unscaledTime; progressionPacket2.ShadeMode = p.Shade.Bond.Mode; progressionPacket2.ShadeRemaining = p.Shade.Bond.Remaining; progressionPacket2.ShadeRank = ((!p.Shade.Bond.VesselRank.HasValue) ? (-2) : ((int)p.Shade.Bond.VesselRank.Value)); progressionPacket2.RitualElapsed = (float)p.Shade.Bond.Elapsed; progressionPacket2.RitualOrigin = p.Shade.RitualOrigin; progressionPacket2.ShadeActors = p.Shade.Actors.Where((CharacterMaster a) => Object.op_Implicit((Object)(object)a)).Select(delegate(CharacterMaster a) { //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) NetworkInstanceId netId2 = ((NetworkBehaviour)a).netId; return ((NetworkInstanceId)(ref netId2)).Value; }).ToArray(); progressionPacket2.ColinMode = p.Colin.Bond.Mode; progressionPacket2.ColinRemaining = p.Colin.Bond.Remaining; progressionPacket2.ColinDeployed = p.Colin.Deployed; progressionPacket2.ColinElapsed = (float)p.Colin.Bond.Elapsed; progressionPacket2.ColinOrigin = p.Colin.Origin; progressionPacket2.GordonMode = p.Gordon.Bond.Mode; progressionPacket2.GordonRemaining = p.Gordon.Bond.Remaining; progressionPacket2.GordonRank = ((!p.Gordon.Bond.VesselRank.HasValue) ? (-2) : ((int)p.Gordon.Bond.VesselRank.Value)); progressionPacket2.GordonElapsed = (float)p.Gordon.Bond.Elapsed; progressionPacket2.GordonOrigin = p.Gordon.RitualOrigin; CharacterMaster? obj = ((IEnumerable<CharacterMaster>)p.Gordon.Actors).FirstOrDefault((Func<CharacterMaster, bool>)((CharacterMaster a) => Object.op_Implicit((Object)(object)a))); int gordonActor; if (obj == null) { gordonActor = 0; } else { netId = ((NetworkBehaviour)obj).netId; gordonActor = (int)((NetworkInstanceId)(ref netId)).Value; } progressionPacket2.GordonActor = (uint)gordonActor; for (int num = 0; num < 5; num++) { Mission val2 = ((num < p.Board.Slots.Count) ? p.Board.Slots[num] : null); progressionPacket2.MissionIds[num] = ((val2 != null) ? val2.Id : 0); progressionPacket2.MissionTitles[num] = ((val2 != null) ? val2.Title : null) ?? ""; progressionPacket2.Missions[num] = ((val2 == null) ? "" : (((val2.DefinitionId > 0) ? (val2.Title + ": ") : "") + val2.Label + " " + ((val2.ObjectiveStatus == "") ? (val2.Progress + "/" + val2.Goal) : val2.ObjectiveStatus) + " · " + val2.Difficulty + ((val2.RequiredStage > 0) ? "" : (" · " + Mathf.CeilToInt(val2.Remaining) + "s")) + "\n" + val2.Reward.Label + ((num == 0 && p.Board.PendingStone != null) ? (" · Banked for next stage: " + p.Board.PendingStone.Label) : ""))); } for (int num2 = 0; num2 < 20; num2++) { progressionPacket2.Cooldowns[num2] = Math.Max(0f, p.ReadyAt[num2] - Time.time); } return progressionPacket2; } internal void Validate() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Invalid comparison between Unknown and I4 //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Invalid comparison between Unknown and I4 //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Invalid comparison between Unknown and I4 //IL_012a: 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: Invalid comparison between Unknown and I4 //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Invalid comparison between Unknown and I4 //IL_0180: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) if (Beacons.Length > 16 || Beacons.Any((ContractBeacon b) => b.Owner == 0 || b.Mission == 0 || !ReaperAnchor.Finite(b.Position) || !float.IsFinite(b.Radius) || b.Radius < 0.1f || b.Radius > 500f || b.Label.Length > 120)) { throw new FormatException("Contract marker"); } if (Master == 0 || RunNetwork == 0 || Serial == 0L || Run.Length != 32 || Notice.Length > 512) { throw new FormatException("Snapshot header"); } Rank val = (Rank)(((??)Snapshot().Tier((Essence)2)) ?? (-1)); if (Enum.IsDefined(typeof(FamiliarMode), ColinMode) && (int)ColinMode != 3 && ColinRemaining >= 0 && ColinRemaining <= FamiliarBond.ColinCapacity(val) && ColinDeployed >= 0 && ColinDeployed <= ColinRemaining && ((int)ColinMode != 5 || (int)val >= 2) && ((int)ColinMode != 7 || (int)val >= 1) && ((int)ColinMode != 8 || (int)val >= 3)) { bool num; if (!FamiliarBond.IsColinMerged(ColinMode)) { if ((int)ColinMode == 4) { goto IL_0158; } num = ColinDeployed != 0; } else { num = ColinDeployed > 1; } if (!num) { goto IL_0158; } } goto IL_018c; IL_0158: if (float.IsFinite(ColinElapsed) && !(ColinElapsed < 0f) && !(ColinElapsed > 20f) && ReaperAnchor.Finite(ColinOrigin)) { if (Blessings < 0) { throw new FormatException("Guardian snapshot"); } if (!Enum.IsDefined(typeof(FamiliarMode), GordonMode) || FamiliarBond.IsColinMerged(GordonMode) || GordonRemaining < 0 || GordonRemaining > 42 || GordonRank < -2 || GordonRank > 7 || !ReaperAnchor.Finite(GordonOrigin) || !float.IsFinite(GordonElapsed) || GordonElapsed < 0f || GordonElapsed > 20f) { throw new FormatException("Gordon snapshot"); } if (!Enum.IsDefined(typeof(FamiliarMode), ShadeMode) || FamiliarBond.IsColinMerged(ShadeMode) || ShadeRemaining < 0 || ShadeRemaining > 42 || ShadeRank < -2 || ShadeRank > 7 || !ReaperAnchor.Finite(RitualOrigin) || float.IsNaN(RitualElapsed) || RitualElapsed < 0f || RitualElapsed > 20f || ShadeActors.Length > 4 || ShadeActors.Any((uint id) => id == 0) || ShadeActors.Distinct().Count() != ShadeActors.Length) { throw new FormatException("Familiar snapshot"); } string[] missions = Missions; for (int num2 = 0; num2 < missions.Length; num2++) { if (missions[num2].Length > 512) { throw new FormatException("Mission length"); } } float[] cooldowns = Cooldowns; foreach (float num3 in cooldowns) { if (float.IsNaN(num3) || float.IsInfinity(num3) || num3 < 0f || num3 > 10000f) { throw new FormatException("Cooldown"); } } return; } goto IL_018c; IL_018c: throw new FormatException("Colin snapshot"); } public override void Serialize(NetworkWriter w) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected I4, but got Unknown //IL_00ec: 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_0136: Expected I4, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected I4, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) w.Write(Master); w.Write(RunNetwork); w.Write(Run); w.Write(Serial); w.Write(Revision); w.Write(Bosses); w.Write(Owned); w.Write(Awakened); w.Write(Notice); w.Write(NoticeSequence); string[] missions = Missions; foreach (string text in missions) { w.Write(text); } float[] cooldowns = Cooldowns; foreach (float num in cooldowns) { w.Write(num); } w.Write((byte)(int)ShadeMode); w.Write(ShadeRemaining); w.Write(ShadeRank); w.Write(RitualElapsed); w.Write(RitualOrigin); w.Write((byte)ShadeActors.Length); uint[] shadeActors = ShadeActors; foreach (uint num2 in shadeActors) { w.Write(num2); } w.Write((byte)(int)GordonMode); w.Write(GordonRemaining); w.Write(GordonRank); w.Write(GordonElapsed); w.Write(GordonOrigin); w.Write(GordonActor); w.Write(Amulet); w.Write(false); w.Write(PhoenixReady); w.Write(Blessings); w.Write((byte)(int)ColinMode); w.Write(ColinRemaining); w.Write(ColinDeployed); w.Write(ColinElapsed); w.Write(ColinOrigin); w.Write((byte)Beacons.Length); ContractBeacon[] beacons = Beacons; foreach (ContractBeacon contractBeacon in beacons) { w.Write(contractBeacon.Owner); w.Write(contractBeacon.Mission); w.Write(contractBeacon.Target); w.Write(contractBeacon.Position); w.Write(contractBeacon.Radius); w.Write(contractBeacon.Label); w.Write(contractBeacon.Accept); w.Write(contractBeacon.Shared); } for (int j = 0; j < MissionIds.Length; j++) { w.Write(MissionIds[j]); w.Write(MissionTitles[j]); } WriteExtra(w); w.Write(CasterBody); } public override void Deserialize(NetworkReader r) { //IL_00b4: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_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) Master = r.ReadUInt32(); RunNetwork = r.ReadUInt32(); Run = r.ReadString(); Serial = r.ReadUInt64(); Revision = r.ReadUInt64(); Bosses = r.ReadInt32(); Owned = r.ReadByte(); Awakened = r.ReadUInt32(); Notice = r.ReadString(); NoticeSequence = r.ReadUInt64(); for (int i = 0; i < 5; i++) { Missions[i] = r.ReadString(); } for (int j = 0; j < 20; j++) { Cooldowns[j] = r.ReadSingle(); } ShadeMode = (FamiliarMode)r.ReadByte(); ShadeRemaining = r.ReadInt32(); ShadeRank = r.ReadInt32(); RitualElapsed = r.ReadSingle(); RitualOrigin = r.ReadVector3(); int num = r.ReadByte(); if (num > 4) { throw new FormatException("Familiar count"); } ShadeActors = new uint[num]; for (int k = 0; k < num; k++) { ShadeActors[k] = r.ReadUInt32(); } GordonMode = (FamiliarMode)r.ReadByte(); GordonRemaining = r.ReadInt32(); GordonRank = r.ReadInt32(); GordonElapsed = r.ReadSingle(); GordonOrigin = r.ReadVector3(); GordonActor = r.ReadUInt32(); Amulet = r.ReadBoolean(); r.ReadBoolean(); PhoenixReady = r.ReadBoolean(); Blessings = r.ReadInt32(); ColinMode = (FamiliarMode)r.ReadByte(); ColinRemaining = r.ReadInt32(); ColinDeployed = r.ReadInt32(); ColinElapsed = r.ReadSingle(); ColinOrigin = r.ReadVector3(); int num2 = r.ReadByte(); if (num2 > 16) { throw new FormatException("Contract markers"); } Beacons = new ContractBeacon[num2]; for (int l = 0; l < num2; l++) { Beacons[l] = new ContractBeacon { Owner = r.ReadUInt32(), Mission = r.ReadUInt32(), Target = r.ReadUInt64(), Position = r.ReadVector3(), Radius = r.ReadSingle(), Label = r.ReadString(), Accept = r.ReadBoolean(), Shared = r.ReadBoolean() }; } if (r.Position < r.Length) { for (int m = 0; m < MissionIds.Length; m++) { MissionIds[m] = r.ReadUInt64(); MissionTitles[m] = r.ReadString(); if (MissionTitles[m].Length > 160) { throw new FormatException("Quest title"); } } } if (r.Position < r.Length) { ReadExtra(r); } if (r.Position < r.Length) { CasterBody = r.ReadUInt32(); } Validate(); } internal uint InvitationFor(uint target) { int num = Array.IndexOf(Invitations, target); if (num < 0 || num >= InvitationTickets.Length) { return 0u; } return InvitationTickets[num]; } private void WriteExtra(NetworkWriter w) { w.Write(Ranking); w.Write(Leader); w.Write(Amount); w.Write(Reserve); w.Write(Permanent); byte[] status = Status; foreach (byte b in status) { w.Write(b); } status = Order; foreach (byte b2 in status) { w.Write(b2); } uint[][] array = new uint[2][] { Invitations, Membership }; uint[] array3; foreach (uint[] array2 in array) { w.Write((byte)array2.Length); array3 = array2; foreach (uint num in array3) { w.Write(num); } } array3 = InvitationTickets; foreach (uint num2 in array3) { w.Write(num2); } } private void ReadExtra(NetworkReader r) { Ranking = r.ReadBoolean(); Leader = r.ReadUInt32(); Amount = r.ReadInt32(); Reserve = r.ReadInt32(); Permanent = r.ReadByte(); for (int i = 0; i < 5; i++) { Status[i] = r.ReadByte(); if (Status[i] > 4) { throw new FormatException("Trial status"); } } for (int j = 0; j < 4; j++) { Order[j] = r.ReadByte(); } if (Order.Distinct().Count() != 4 || Order.Any((byte e) => !EssenceProgression.Essences.Contains((Essence)e)) || Permanent > 15 || Amount < 0 || Reserve < 0) { throw new FormatException("Milestone state"); } Invitations = ReadIds(); Membership = ReadIds(); if (r.Position >= r.Length) { return; } InvitationTickets = new uint[Invitations.Length]; for (int num = 0; num < InvitationTickets.Length; num++) { InvitationTickets[num] = r.ReadUInt32(); if (InvitationTickets[num] == 0) { throw new FormatException("Party invitation identity"); } } uint[] ReadIds() { uint[] array = new uint[r.ReadByte()]; for (int k = 0; k < array.Length; k++) { array[k] = r.ReadUInt32(); } return array; } } } internal readonly struct CloakArmPose { internal readonly Vector3 Root; internal readonly Vector3 Elbow; internal readonly Quaternion Grip; internal CloakArmPose(Vector3 root, Vector3 elbow, Quaternion grip) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Root = root; Elbow = elbow; Grip = grip; } } internal sealed class CloakBackSurface { private struct Mount { internal int face; internal Vector3 barycentric; internal Vector3 rest; internal float inwardSign; } internal const int Capacity = 8; private readonly Transform[] bones; private readonly Matrix4x4[] binds; private readonly int spine; private readonly Vector3[] vertices; private readonly BoneWeight[] weights; private readonly int[] triangles; private readonly List<int> faces = new List<int>(); private readonly List<float> areas = new List<float>(); private readonly List<Mount> mounts = new List<Mount>(8); private readonly Random random; private Vector3[] lift = Array.Empty<Vector3>(); private float spread; internal int Count => mounts.Count; internal bool Available => faces.Count > 0; internal CloakBackSurface(SkinnedMeshRenderer cloak, int seed, Mesh? rest = null) { //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_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_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) random = new Random(seed); Mesh val = rest ?? cloak.sharedMesh; vertices = val.vertices; triangles = val.triangles; weights = val.boneWeights; binds = val.bindposes; bones = cloak.bones; spine = Array.FindIndex(bones, (Transform b) => ((Object)b).name == "2ssy00t0 spine"); bool[] array = new bool[bones.Length]; int num2; int num3; for (int num = 0; num < bones.Length; array[num2] = (byte)num3 != 0, num++) { string name = ((Object)bones[num]).name; num2 = num; switch (name) { default: if (!name.Contains(" backcape bone")) { num3 = (name.Contains(" sidecape bone") ? 1 : 0); continue; } break; case "2ssy00t0 pelvis": case "2ssy00t0 spine": case "2ssy00t0 spine1": case "2ssy00t0 left wear": case "2ssy00t0 right wear": break; } num3 = 1; } bool[] array2 = new bool[vertices.Length]; Vector3[] normals = val.normals; for (int num4 = 0; num4 < array2.Length; num4++) { Vector3 val2 = vertices[num4]; BoneWeight val3 = weights[num4]; array2[num4] = val2.z < -0.055f && normals[num4].z < -0.35f && Mathf.Abs(val2.x) < 0.29f && val2.y > 0.35f && val2.y < 1.3f && array[((BoneWeight)(ref val3)).boneIndex0] && (((BoneWeight)(ref val3)).weight1 == 0f || array[((BoneWeight)(ref val3)).boneIndex1]) && (((BoneWeight)(ref val3)).weight2 == 0f || array[((BoneWeight)(ref val3)).boneIndex2]) && (((BoneWeight)(ref val3)).weight3 == 0f || array[((BoneWeight)(ref val3)).boneIndex3]); } float num5 = 0f; for (int num6 = 0; num6 < triangles.Length; num6 += 3) { int num7 = triangles[num6]; int num8 = triangles[num6 + 1]; int num9 = triangles[num6 + 2]; if (array2[num7] && array2[num8] && array2[num9]) { Vector3 val4 = Vector3.Cross(vertices[num8] - vertices[num7], vertices[num9] - vertices[num7]); float magnitude = ((Vector3)(ref val4)).magnitude; if (!(magnitude <= 1E-08f)) { num5 += magnitude; areas.Add(num5); faces.Add(num6); } } } } internal void FollowFold(Vector3[] deltas, float amount) { lift = deltas; spread = amount; } private Mount Sample() { //IL_0084: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_017c: 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) float item = (float)random.NextDouble() * areas[areas.Count - 1]; int num = areas.BinarySearch(item); int num2 = faces[(num < 0) ? (~num) : num]; float num3 = Mathf.Sqrt((float)random.NextDouble()); float num4 = (float)random.NextDouble(); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(1f - num3, num3 * (1f - num4), num3 * num4); Vector3 rest = val.x * vertices[triangles[num2]] + val.y * vertices[triangles[num2 + 1]] + val.z * vertices[triangles[num2 + 2]]; Vector3 val2 = vertices[triangles[num2]]; Vector3 val3 = vertices[triangles[num2 + 1]]; Vector3 val4 = vertices[triangles[num2 + 2]]; float inwardSign = ((Vector3.Cross(val3 - val2, val4 - val2).z >= 0f) ? 1f : (-1f)); return new Mount { face = num2, barycentric = val, rest = rest, inwardSign = inwardSign }; } internal void Grow(int count) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) while (Available && mounts.Count < Mathf.Min(count, 8)) { Mount item = default(Mount); float num = -1f; for (int i = 0; i < 768; i++) { Mount mount = Sample(); if (mount.rest.y < 0.56f || mount.rest.y > 1.23f) { continue; } float num2 = float.PositiveInfinity; foreach (Mount mount2 in mounts) { Vector3 val = mount.rest - mount2.rest; float magnitude = ((Vector3)(ref val)).magnitude; float num3 = ((mount.rest.x * mount2.rest.x > 0f) ? Mathf.Sqrt(val.x * val.x + 1.22f * val.y * val.y) : magnitude); num2 = Mathf.Min(num2, Mathf.Min(magnitude, num3)); } if (num2 > num) { item = mount; num = num2; } if (num2 >= 0.168f) { break; } } if (!(num < 0f)) { mounts.Add(item); continue; } break; } } private Vector3 Skin(int index) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b4: 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_0042: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_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_0115: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) Vector3 p = vertices[index]; if (spread > 0f && index < lift.Length) { p += lift[index] * spread; } BoneWeight val = weights[index]; Vector3 val2 = ((BoneWeight)(ref val)).weight0 * offset(((BoneWeight)(ref val)).boneIndex0); if (((BoneWeight)(ref val)).weight1 > 0f) { val2 += ((BoneWeight)(ref val)).weight1 * offset(((BoneWeight)(ref val)).boneIndex1); } if (((BoneWeight)(ref val)).weight2 > 0f) { val2 += ((BoneWeight)(ref val)).weight2 * offset(((BoneWeight)(ref val)).boneIndex2); } if (((BoneWeight)(ref val)).weight3 > 0f) { val2 += ((BoneWeight)(ref val)).weight3 * offset(((BoneWeight)(ref val)).boneIndex3); } return val2; Vector3 offset(int bone) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) return bones[bone].TransformPoint(((Matrix4x4)(ref binds[bone])).MultiplyPoint3x4(p)); } } internal Quaternion TorsoRotation(Transform model) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (spine < 0) { return model.rotation; } Matrix4x4 val = bones[spine].localToWorldMatrix * binds[spine]; return Quaternion.LookRotation(((Matrix4x4)(ref val)).MultiplyVector(Vector3.forward), ((Matrix4x4)(ref val)).MultiplyVector(Vector3.up)); } internal CloakArmPose Pose(int index, Quaternion torso) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f4: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) Mount mount = mounts[index]; int face = mount.face; Vector3 val = Skin(triangles[face]); Vector3 val2 = Skin(triangles[face + 1]); Vector3 val3 = Skin(triangles[face + 2]); Vector3 val4 = (0f - mount.inwardSign) * Vector3.Cross(val2 - val, val3 - val); Vector3 val5 = torso * Vector3.back; Vector3 val6 = torso * Vector3.up; Vector3 val7; if (((Vector3)(ref val4)).sqrMagnitude > 1E-10f && Vector3.Dot(val4, val5) > 0f) { val7 = val5 + 0.15f * ((Vector3)(ref val4)).normalized; val5 = ((Vector3)(ref val7)).normalized; } Vector3 val8 = ((mount.rest.x < 0f) ? (-1f) : 1f) * (torso * Vector3.right); float num = Mathf.Clamp01((mount.rest.y - 0.6f) / 0.57f); val7 = (0.51f + 2.6f * Mathf.Abs(mount.rest.x)) * val8 + 1.2f * val5; Vector3 normalized = ((Vector3)(ref val7)).normalized; Vector3 val9 = val * mount.barycentric.x + val2 * mount.barycentric.y + val3 * mount.barycentric.z; float num2 = 0.35f + 0.06f * num; val7 = normalized + (-0.04f + 0.76f * num) * val6; Vector3 elbow = val9 + num2 * ((Vector3)(ref val7)).normalized; val7 = val6 - 0.42f * normalized; Vector3 normalized2 = ((Vector3)(ref val7)).normalized; val7 = Vector3.ProjectOnPlane(val8 + (0.57f + 0.3f * num) * val5, normalized2); Quaternion grip = Quaternion.LookRotation(Vector3.Cross(((Vector3)(ref val7)).normalized, normalized2), normalized2); return new CloakArmPose(val9, elbow, grip); } } public sealed class CloakCuts : MonoBehaviour { private sealed class Sequence { internal LineRenderer Edge; internal LineRenderer Core; internal Random Angles; internal int Remaining; internal float Age; internal float Step; internal Vector3 Direction; } internal const int Samples = 7; private static readonly Color violet = new Color(0.67f, 0.19f, 1f, 1f); private static readonly Color highlight = new Color(0.95f, 0.75f, 1f, 1f); private readonly List<Sequence> slots = new List<Sequence>(); private static readonly Random seeds = new Random(); private Material? material; private CharacterBody body; internal static int NewSeed() { return seeds.Next(); } internal static void Play(CharacterBody owner, int count, int seed) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if (count > 0 && Object.op_Implicit((Object)(object)owner) && (int)SystemInfo.graphicsDeviceType != 4) { CloakCuts cloakCuts = ((Component)owner).GetComponent<CloakCuts>(); if (!Object.op_Implicit((Object)(object)cloakCuts)) { cloakCuts = ((Component)owner).gameObject.AddComponent<CloakCuts>(); } cloakCuts.Begin(owner, Mathf.Min(count, 8), seed); } } private void Begin(CharacterBody owner, int count, int seed) { //IL_009b: 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) body = owner; if (!Object.op_Implicit((Object)(object)material)) { material = BeamSurface.Create(((Component)this).gameObject, "Jason purple cloak cuts"); material.mainTexture = (Texture)(object)Texture2D.whiteTexture; material.renderQueue = 3100; } Sequence sequence = null; foreach (Sequence slot in slots) { if (slot.Remaining == 0) { sequence = slot; break; } } if (sequence == null) { sequence = new Sequence { Edge = Line("Purple cut", 0.078f, violet, 0), Core = Line("Cut highlight", 0.026f, highlight, 1) }; slots.Add(sequence); } sequence.Angles = new Random(seed); sequence.Remaining = count; sequence.Step = Mathf.Clamp(0.055f / Mathf.Clamp(owner.attackSpeed, 0.45f, 2.75f), 0.026f, 0.068f); sequence.Age = -1f; ((Behaviour)this).enabled = true; } private LineRenderer Line(string label, float width, Color tint, int order) { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown GameObject val = new GameObject(label); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); ((Renderer)val2).enabled = false; val2.positionCount = 7; val2.useWorldSpace = true; val2.alignment = (LineAlignment)0; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; ((Renderer)val2).sharedMaterial = material; Color startColor = (val2.endColor = tint); val2.startColor = startColor; val2.widthCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[6] { new Keyframe(0f, 0f), new Keyframe(1f / 6f, 0.28f), new Keyframe(0.5f, 0.9f), new Keyframe(2f / 3f, 1f), new Keyframe(5f / 6f, 0.63f), new Keyframe(1f, 0f) }); val2.widthMultiplier = width; ((Renderer)val2).sortingOrder = order; return val2; } private void LateUpdate() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //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_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_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_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { ((Behaviour)this).enabled = false; return; } Quaternion val = (Object.op_Implicit((Object)(object)body.characterDirection) ? Quaternion.Euler(0f, body.characterDirection.yaw, 0f) : ((Component)this).transform.rotation); Vector3 val2 = body.corePosition + val * Vector3.forward * 1.85f + Vector3.up * 0.28f; bool flag = false; foreach (Sequence slot in slots) { if (slot.Remaining <= 0) { continue; } if (slot.Age >= slot.Step) { slot.Age = -1f; if (--slot.Remaining == 0) { LineRenderer edge = slot.Edge; bool enabled = (((Renderer)slot.Core).enabled = false); ((Renderer)edge).enabled = enabled; continue; } } flag = true; if (slot.Age < 0f) { float num = (float)(slot.Angles.NextDouble() * 2.0 * Math.PI); slot.Direction = new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f); slot.Age = 0f; LineRenderer edge2 = slot.Edge; bool enabled = (((Renderer)slot.Core).enabled = true); ((Renderer)edge2).enabled = enabled; } float num2 = slot.Age / slot.Step; Vector3 val3 = val * slot.Direction; Vector3 val4 = val * new Vector3(0f - slot.Direction.y, slot.Direction.x, 0f); float num3 = 1f - (1f - num2) * (1f - num2); float num4 = Mathf.Lerp(-0.24f, 1.63f, num3); float num5 = Mathf.Lerp(-1.63f, 1.5f, num2 * num2); float num6 = 1f - num2 * num2; LineRenderer edge3 = slot.Edge; Color startColor = (slot.Edge.endColor = new Color(violet.r, violet.g, violet.b, num6)); edge3.startColor = startColor; LineRenderer core = slot.Core; startColor = (slot.Core.endColor = new Color(highlight.r, highlight.g, highlight.b, num6)); core.startColor = startColor; for (int i = 0; i < 7; i++) { float num7 = (float)i / 6f; float num8 = Mathf.Lerp(num5, num4, num7); float num9 = 0.074f * (1f - num8 * num8 / 2.6896f); Vector3 val7 = val2 + val3 * num8 + val4 * num9; slot.Edge.SetPosition(i, val7); slot.Core.SetPosition(i, val7); } slot.Age += Mathf.Min(Time.deltaTime, slot.Step); } if (!flag) { ((Behaviour)this).enabled = false; } } private void OnDisable() { foreach (Sequence slot in slots) { slot.Remaining = 0; if (Object.op_Implicit((Object)(object)slot.Edge)) { ((Renderer)slot.Edge).enabled = false; } if (Object.op_Implicit((Object)(object)slot.Core)) { ((Renderer)slot.Core).enabled = false; } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } } } internal readonly struct CloakDoomFit { internal const float HandleY = -0.13f; internal readonly Vector3 Palm; internal readonly Vector3 Origin; internal readonly Quaternion Rotation; internal readonly float Scale; internal CloakDoomFit(IReadOnlyList<Vector3> knife, IReadOnlyList<Vector3> fabric) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01a9: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_023e: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) if (knife.Count == 0) { throw new ArgumentException("No equipped weapon geometry"); } Vector3 val = knife[0]; Vector3 val2 = knife[0]; foreach (Vector3 item in knife) { if (item.x > val.x) { val = item; } if (item.x < val2.x) { val2 = item; } } Vector3 val3 = val - val2; Vector3 normalized = ((Vector3)(ref val3)).normalized; val3 = val - val2; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude < 0.0001f) { throw new ArgumentException("Equipped weapon has no span"); } float num = 1f; float num2 = 0f; foreach (Vector3 item2 in fabric) { Vector3 val4 = item2 - val2; float num3 = Vector3.Dot(val4, normalized) / magnitude; if (!(num3 < 0.1f) && !(num3 > 0.43f)) { val3 = val4 - normalized * (magnitude * num3); if (!(((Vector3)(ref val3)).sqrMagnitude > magnitude * magnitude * 0.11f * 0.11f)) { num = Mathf.Min(num, num3); num2 = Mathf.Max(num2, num3); } } } float num4 = ((num2 >= num) ? ((num + num2) * 0.5f) : 0.24f); Vector3 val5 = val2 + normalized * (num4 * magnitude); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity); Vector3 val7 = -val6; bool flag = false; foreach (Vector3 item3 in knife) { if (!(Mathf.Abs(Vector3.Dot(item3 - val5, normalized)) > 0.065f * magnitude)) { Vector3 val8 = Vector3.ProjectOnPlane(item3 - val5, normalized); val6 = new Vector3(Mathf.Min(val6.x, val8.x), Mathf.Min(val6.y, val8.y), Mathf.Min(val6.z, val8.z)); val7 = new Vector3(Mathf.Max(val7.x, val8.x), Mathf.Max(val7.y, val8.y), Mathf.Max(val7.z, val8.z)); flag = true; } } Palm = (flag ? (val5 + 0.5f * (val6 + val7)) : val5); val3 = Palm - val2; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; val3 = Vector3.ProjectOnPlane(Vector3.forward, normalized2); Vector3 normalized3 = ((Vector3)(ref val3)).normalized; Rotation = Quaternion.LookRotation(normalized3, normalized2); Scale = magnitude / 0.5f; Origin = Palm - Rotation * (Vector3.up * (-0.13f * Scale)); } } internal sealed class CloakDoomWeapon { internal const string NativeNode = "Equipped pose"; internal const string DoomNode = "Blade of Doom socket"; private readonly GameObject native; private readonly GameObject awakened; internal CloakDoomWeapon(Transform grip, SkinnedMeshRenderer blade, SkinnedMeshRenderer crystal) { native = ((Component)grip.Find("Equipped pose")).gameObject; Transform val = grip.Find("Blade of Doom socket"); awakened = ((Component)val).gameObject; AddPart(val, blade); AddPart(val, crystal); } private static void AddPart(Transform socket, SkinnedMeshRenderer source) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(((Object)source).name); val.transform.SetParent(socket, false); val.AddComponent<MeshFilter>().sharedMesh = source.sharedMesh; ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = ((Renderer)source).sharedMaterial; } internal void Show(bool active) { if (awakened.activeSelf != active) { awakened.SetActive(active); } if (native.activeSelf == active) { native.SetActive(!active); } } } internal sealed class CloakFabricMesh { private readonly List<Vector3> positions = new List<Vector3>(); private readonly List<Vector3> normals = new List<Vector3>(); private readonly List<Vector2> uv = new List<Vector2>(); internal static Vector2 Project(Vector3 p, Vector3 face, bool sleeve) { //IL_001e: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (sleeve ? new Vector2(0.6107448f, 0.2368742f) : new Vector2(0.2222222f, 0.2676435f)); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(Mathf.Abs(face.x), Mathf.Abs(face.y), Mathf.Abs(face.z)); Vector2 val3 = ((val2.y >= val2.x && val2.y >= val2.z) ? new Vector2(p.x, p.z) : ((val2.x >= val2.z) ? new Vector2(p.z, p.y) : new Vector2(p.x, p.y))); return val + 0.22f * val3; } internal void Add(Vector3[] vertices, IList<int> triangles, bool sleeve) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: U