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 Asriel Dreemurr v0.18.18
BepInEx/plugins/AsrielDreemurr/AsrielDreemurrMod.dll
Decompiled a month 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using Microsoft.CodeAnalysis; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Animations; using UnityEngine.Networking; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 AsrielDreemurrMod { internal sealed class ArtificerMotion { private sealed class Pair { internal Transform Source; internal Transform Target; internal Quaternion SourceRest; internal Quaternion TargetRest; } private readonly List<Action> releaseAssets = new List<Action>(); private readonly List<Pair> pairs = new List<Pair>(); private GameObject hidden; private Transform sourceRoot; private Transform targetRoot; private PlayableGraph graph; private AnimationMixerPlayable mixer; private AnimationClipPlayable[] players; private AnimationClip[] clips; private float[] weights; private float clock; private float lean; private float leanVelocity; private bool attempted; private bool validated; internal bool Ready { get { if (validated) { return ((PlayableGraph)(ref graph)).IsValid(); } return false; } } private static string Key(string name) { return new string(name.ToLowerInvariant().Where(char.IsLetterOrDigit).ToArray()); } private static AnimationClip Select(AnimationClip[] source, params string[] names) { string[] array = names; foreach (string name in array) { AnimationClip val = ((IEnumerable<AnimationClip>)source).FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip c) => Key(((Object)c).name) == Key(name))); if (Object.op_Implicit((Object)(object)val)) { return val; } } array = names; foreach (string name2 in array) { string wanted = Key(name2); AnimationClip val2 = (from c in source where Key(((Object)c).name).Contains(wanted) && !new string[5] { "attack", "gesture", "reload", "death", "cast" }.Any((string x) => Key(((Object)c).name).Contains(x)) orderby ((Motion)c).isLooping descending, Key(((Object)c).name).Length select c).ThenBy<AnimationClip, string>((AnimationClip c) => ((Object)c).name, StringComparer.Ordinal).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val2)) { return val2; } } return null; } internal bool Create(Transform target) { //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_07f3: Unknown result type (might be due to invalid IL or missing references) //IL_07f8: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) if (attempted) { return Ready; } attempted = true; if (!AsrielConfig.UseArtificerAnimations.Value) { return false; } Avatar sourceAvatar; Transform[] bones; try { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/MageBody"); 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)) { throw new InvalidOperationException("MageBody model is unavailable"); } Animator component = ((Component)val2.modelTransform).GetComponent<Animator>(); if (!Object.op_Implicit((Object)(object)component)) { throw new InvalidOperationException("Mage model has no Animator"); } ModelSkinController component2 = ((Component)val2.modelTransform).GetComponent<ModelSkinController>(); RuntimeAnimatorController val3 = component.runtimeAnimatorController; if (!Object.op_Implicit((Object)(object)val3)) { val3 = ResolveAsset<RuntimeAnimatorController>((object)component2); } if (!Object.op_Implicit((Object)(object)val3)) { throw new InvalidOperationException("Mage controller was unavailable through both direct and skin asset references"); } sourceAvatar = component.avatar; if (!Object.op_Implicit((Object)(object)sourceAvatar)) { sourceAvatar = ResolveAsset<Avatar>((object)component2); } AnimationClip[] source = (from c in val3.animationClips.Distinct() where Object.op_Implicit((Object)(object)c) && c.length > 0.01f select c).ToArray(); AnimationClip val4 = Select(source, "Idle", "IdleLoop"); AnimationClip val5 = Select(source, "FlyForward", "HoverForward", "WalkForward", "RunForward", "Walk", "Run"); AnimationClip val6 = Select(source, "SprintForward", "Sprint", "FlyForward", "RunForward", "Run"); AnimationClip val7 = Select(source, "FlyLoop", "HoverLoop", "FlightLoop", "JetLoop", "JumpLoop", "Fly", "Hover", "Flight"); if (!Object.op_Implicit((Object)(object)val4) || !Object.op_Implicit((Object)(object)val5) || !Object.op_Implicit((Object)(object)val6)) { throw new InvalidOperationException("Mage locomotion clips were not found; available: " + string.Join(", ", source.Select((AnimationClip c) => ((Object)c).name))); } clips = (AnimationClip[])(object)new AnimationClip[4] { val4, val5, val6, Object.op_Implicit((Object)(object)val7) ? val7 : val4 }; hidden = new GameObject("AsrielMagePoseSource"); hidden.SetActive(false); hidden.transform.position = new Vector3(0f, -10000f, 0f); GameObject val8 = Object.Instantiate<GameObject>(((Component)val2.modelTransform).gameObject, hidden.transform, false); sourceRoot = val8.transform; targetRoot = target; Behaviour[] componentsInChildren = val8.GetComponentsInChildren<Behaviour>(true); foreach (Behaviour val9 in componentsInChildren) { if (!(val9 is Animator)) { val9.enabled = false; } } Renderer[] componentsInChildren2 = val8.GetComponentsInChildren<Renderer>(true); for (int num = 0; num < componentsInChildren2.Length; num++) { componentsInChildren2[num].enabled = false; } Collider[] componentsInChildren3 = val8.GetComponentsInChildren<Collider>(true); for (int num = 0; num < componentsInChildren3.Length; num++) { componentsInChildren3[num].enabled = false; } ParticleSystem[] componentsInChildren4 = val8.GetComponentsInChildren<ParticleSystem>(true); for (int num = 0; num < componentsInChildren4.Length; num++) { componentsInChildren4[num].Stop(true, (ParticleSystemStopBehavior)0); } bones = ((Component)sourceRoot).GetComponentsInChildren<Transform>(true); Map("Hips", new string[3] { "pelvis", "hips", "hip" }); Map("Spine", new string[3] { "stomach", "spine", "spine1" }); Map("Chest", new string[2] { "chest", "spine2" }); Map("UpperChest", new string[2] { "upperchest", "spine3" }); Map("Neck", new string[1] { "neck" }); Map("Head", new string[1] { "head" }); string[] array = new string[2] { "L", "R" }; foreach (string text in array) { string text2 = text.ToLowerInvariant(); Map("Shoulder." + text, new string[2] { "clavicle." + text2, "shoulder." + text2 }); Map("UpperArm." + text, new string[2] { "upper_arm." + text2, "upperarm." + text2 }); Map("LowerArm." + text, new string[3] { "lower_arm." + text2, "forearm." + text2, "lowerarm." + text2 }); Map("Hand." + text, new string[1] { "hand." + text2 }); Map("UpperLeg." + text, new string[2] { "thigh." + text2, "upperleg." + text2 }); Map("LowerLeg." + text, new string[3] { "calf." + text2, "shin." + text2, "lowerleg." + text2 }); Map("Foot." + text, new string[1] { "foot." + text2 }); Map("Toes." + text, new string[2] { "toe." + text2, "toes." + text2 }); } if (new string[14] { "Hips", "Head", "UpperArm.L", "UpperArm.R", "LowerArm.L", "LowerArm.R", "Hand.L", "Hand.R", "UpperLeg.L", "UpperLeg.R", "LowerLeg.L", "LowerLeg.R", "Foot.L", "Foot.R" }.Any((string n) => !pairs.Any((Pair p) => ((Object)p.Target).name == n))) { throw new InvalidOperationException("Mage skeleton mapping incomplete; source bones: " + string.Join(", ", bones.Select((Transform b) => ((Object)b).name))); } pairs.Sort((Pair a, Pair b) => Depth(a.Target).CompareTo(Depth(b.Target))); Animator component3 = val8.GetComponent<Animator>(); component3.runtimeAnimatorController = val3; if (Object.op_Implicit((Object)(object)sourceAvatar)) { component3.avatar = sourceAvatar; } component3.applyRootMotion = false; component3.fireEvents = false; component3.cullingMode = (AnimatorCullingMode)0; graph = PlayableGraph.Create("AsrielMageRetarget"); ((PlayableGraph)(ref graph)).SetTimeUpdateMode((DirectorUpdateMode)3); mixer = AnimationMixerPlayable.Create(graph, 4); players = (AnimationClipPlayable[])(object)new AnimationClipPlayable[4]; weights = new float[4] { 1f, 0f, 0f, 0f }; for (int num2 = 0; num2 < 4; num2++) { players[num2] = AnimationClipPlayable.Create(graph, clips[num2]); ((AnimationClipPlayable)(ref players[num2])).SetApplyFootIK(false); ((AnimationClipPlayable)(ref players[num2])).SetApplyPlayableIK(false); PlayableExtensions.SetSpeed<AnimationClipPlayable>(players[num2], 0.0); ((PlayableGraph)(ref graph)).Connect<AnimationClipPlayable, AnimationMixerPlayable>(players[num2], 0, mixer, num2); } PlayableOutputExtensions.SetSourcePlayable<AnimationPlayableOutput, AnimationMixerPlayable>(AnimationPlayableOutput.Create(graph, "MagePose", component3), mixer); hidden.SetActive(true); ((PlayableGraph)(ref graph)).Play(); string text3 = ValidateSamples(); validated = true; string text4 = "Artificer movement source ready: " + pairs.Count + " mapped bones; idle/walk/sprint/flight = " + string.Join(" / ", clips.Select((AnimationClip c) => ((Object)c).name)) + ". Mage clip binding and rotation sampling passed. Asriel owns his shoulders, arms and hands; custom attack clips remain Asriel's."; Report(text4 + "\nController: " + ((Object)val3).name + "\nAvatar: " + (Object.op_Implicit((Object)(object)sourceAvatar) ? ((Object)sourceAvatar).name : "generic skeleton") + "\n" + text3 + "\nBone mapping:\n" + string.Join("\n", pairs.Select((Pair p) => ((Object)p.Source).name + " -> " + ((Object)p.Target).name))); AsrielPlugin.Log.LogInfo((object)text4); return true; } catch (Exception ex) { Destroy(); string text5 = "Artificer retarget unavailable: " + ex.Message + ". Using the included Asriel glide clips. Send ArtificerMovementReport.txt or this line from LogOutput.log for the installed-game mapping."; Report(text5); AsrielPlugin.Log.LogWarning((object)text5); return false; } void Map(string name, string[] aliases) { //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_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_01c8: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_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) Transform val10 = BattleAssets.Bone(target, name); Transform val11 = BattleAssets.Bone(BattleAssets.Model.transform, name); Transform s = ((IEnumerable<Transform>)bones).FirstOrDefault((Func<Transform, bool>)((Transform b) => aliases.Any((string alias) => Key(((Object)b).name) == Key(alias)))); if (!Object.op_Implicit((Object)(object)s) && Object.op_Implicit((Object)(object)sourceAvatar) && sourceAvatar.isHuman) { string humanName = (name.EndsWith(".L") ? ("Left" + name.Substring(0, name.Length - 2)) : (name.EndsWith(".R") ? ("Right" + name.Substring(0, name.Length - 2)) : name)); HumanBone human = ((IEnumerable<HumanBone>)sourceAvatar.humanDescription.human).FirstOrDefault((Func<HumanBone, bool>)((HumanBone h) => ((HumanBone)(ref h)).humanName == humanName)); if (!string.IsNullOrEmpty(((HumanBone)(ref human)).boneName)) { s = ((IEnumerable<Transform>)bones).FirstOrDefault((Func<Transform, bool>)((Transform b) => ((Object)b).name == ((HumanBone)(ref human)).boneName)); } } if (Object.op_Implicit((Object)(object)val10) && Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)s) && !pairs.Any((Pair p) => (Object)(object)p.Source == (Object)(object)s)) { pairs.Add(new Pair { Source = s, Target = val10, SourceRest = Quaternion.Inverse(sourceRoot.rotation) * s.rotation, TargetRest = Quaternion.Inverse(BattleAssets.Model.transform.rotation) * val11.rotation }); } } } private string ValidateSamples() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: 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_00fa: 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_0122: 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) StringBuilder stringBuilder = new StringBuilder(); string[] array = new string[4] { "idle", "walk", "sprint", "flight" }; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(mixer, j, (float)((j == i) ? 1 : 0)); } Quaternion[] array2 = null; float num = 0f; float num2 = 0f; float num3 = 0f; float[] array3 = new float[3] { 0f, 0.23f, 0.61f }; foreach (float num4 in array3) { PlayableExtensions.SetTime<AnimationClipPlayable>(players[i], (double)(clips[i].length * num4)); ((PlayableGraph)(ref graph)).Evaluate(0f); Quaternion[] array4 = pairs.Select((Pair p) => Quaternion.Inverse(sourceRoot.rotation) * p.Source.rotation).ToArray(); for (int num5 = 0; num5 < pairs.Count; num5++) { float num6 = Quaternion.Angle(pairs[num5].SourceRest, array4[num5]); num = Mathf.Max(num, num6); if (array2 != null) { num2 = Mathf.Max(num2, Quaternion.Angle(array2[num5], array4[num5])); } if (((Object)pairs[num5].Target).name.Contains("Leg") || ((Object)pairs[num5].Target).name.StartsWith("Foot", StringComparison.Ordinal)) { num3 = Mathf.Max(num3, num6); } } if (array2 == null) { array2 = array4; } } stringBuilder.AppendLine(array[i] + ": " + ((Object)clips[i]).name + "; rest delta " + num.ToString("F3", CultureInfo.InvariantCulture) + " deg; sampled motion " + num2.ToString("F3", CultureInfo.InvariantCulture) + " deg; leg pose delta " + num3.ToString("F3", CultureInfo.InvariantCulture) + " deg"); if ((i == 1 || i == 2) && Mathf.Max(num, num2) < 0.05f) { throw new InvalidOperationException("Mage " + array[i] + " clip did not animate the mapped skeleton: " + ((Object)clips[i]).name + "; " + stringBuilder); } } for (int num7 = 0; num7 < 4; num7++) { PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(mixer, num7, (float)((num7 == 0) ? 1 : 0)); PlayableExtensions.SetTime<AnimationClipPlayable>(players[num7], 0.0); } ((PlayableGraph)(ref graph)).Evaluate(0f); clock = 0f; return stringBuilder.ToString(); } private static void Report(string text) { try { File.WriteAllText(Path.Combine(Path.GetDirectoryName(typeof(AsrielPlugin).Assembly.Location), "ArtificerMovementReport.txt"), "Asriel 0.18.18\n" + DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture) + "\n" + text + "\n"); } catch (Exception ex) { AsrielPlugin.Log.LogWarning((object)("Could not write Artificer movement report: " + ex.Message)); } } private T ResolveAsset<T>(object root) where T : Object { if (root == null) { return default(T); } return Read(root, 0); T Read(object value, int depth) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) T val = (T)((value is T) ? value : null); if (val != null) { return val; } if (value == null || depth > 3) { return default(T); } AssetReference val2 = (AssetReference)((value is AssetReference) ? value : null); if (val2 != null) { if (!val2.RuntimeKeyIsValid()) { return default(T); } AsyncOperationHandle<T> handle = Addressables.LoadAssetAsync<T>(val2.RuntimeKey); releaseAssets.Add(delegate { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (handle.IsValid()) { Addressables.Release<T>(handle); } }); return handle.WaitForCompletion(); } Type type = value.GetType(); while (type != null && type != typeof(Object)) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { Type fieldType = fieldInfo.FieldType; if (fieldType == typeof(T) || typeof(AssetReference).IsAssignableFrom(fieldType) || (fieldType.IsGenericType && fieldType.GetGenericArguments().Contains<Type>(typeof(T)))) { T val3 = Read(fieldInfo.GetValue(value), depth + 1); if (Object.op_Implicit((Object)(object)val3)) { return val3; } } } type = type.BaseType; } return default(T); } } private static int Depth(Transform t) { int num = 0; while (Object.op_Implicit((Object)(object)t.parent)) { num++; t = t.parent; } return num; } internal void Apply(HoverMotion motion, bool flying, float delta, float strength) { //IL_0064: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c5: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return; } int num = ((flying && motion == HoverMotion.Idle) ? 3 : ((motion == HoverMotion.Run) ? 2 : ((motion == HoverMotion.Walk) ? 1 : 0))); clock += delta; float num2 = 1f - Mathf.Exp((0f - delta) * 9f); for (int i = 0; i < 4; i++) { weights[i] = Mathf.Lerp(weights[i], (float)((i == num) ? 1 : 0), num2); PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(mixer, i, weights[i]); PlayableExtensions.SetTime<AnimationClipPlayable>(players[i], (double)(clock / 2.8f % 1f * clips[i].length)); } ((PlayableGraph)(ref graph)).Evaluate(0f); float num3 = motion switch { HoverMotion.Walk => 6f, HoverMotion.Run => 12f, _ => 0f, }; if (delta > 0f) { lean = Mathf.SmoothDamp(lean, num3, ref leanVelocity, 0.2f, float.PositiveInfinity, delta); } Quaternion val = Quaternion.AngleAxis(lean, targetRoot.right); foreach (Pair pair in pairs) { if (!AsrielGlideArms.OwnsBone(((Object)pair.Target).name)) { Quaternion val2 = Quaternion.Inverse(sourceRoot.rotation) * pair.Source.rotation; Quaternion val3 = val * targetRoot.rotation * (val2 * Quaternion.Inverse(pair.SourceRest)) * pair.TargetRest; pair.Target.rotation = Quaternion.Slerp(pair.Target.rotation, val3, strength); } } } internal void Reset() { Destroy(); attempted = false; } internal void Destroy() { lean = (leanVelocity = (clock = 0f)); validated = false; if (((PlayableGraph)(ref graph)).IsValid()) { ((PlayableGraph)(ref graph)).Destroy(); } if (Object.op_Implicit((Object)(object)hidden)) { Object.Destroy((Object)(object)hidden); } hidden = null; pairs.Clear(); foreach (Action releaseAsset in releaseAssets) { releaseAsset(); } releaseAssets.Clear(); } } public sealed class AsrielTargetedSkillDef : SkillDef { public bool RequireSafeBlink; public bool UseGonerRange; public override bool IsReady(GenericSkill slot) { //IL_0031: 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_006b: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (!((SkillDef)this).IsReady(slot)) { return false; } CharacterBody component = ((Component)slot).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inputBank)) { return false; } Ray ray = default(Ray); ((Ray)(ref ray))..ctor(component.inputBank.aimOrigin, component.inputBank.aimDirection); Vector3 point; if (!RequireSafeBlink) { if (!UseGonerRange) { return GroundTarget.Find(component, ray, out point); } return GroundTarget.FindGoner(component, ray, out point); } return GroundTarget.BlinkDestination(component, ray, out point); } } public sealed class AsrielAbilityInput : MonoBehaviour { private static readonly Type[] Moves = new Type[6] { typeof(StarfireState), typeof(ShockerBreakerState), typeof(ChaosSaberState), typeof(ChaosBeamState), typeof(GodstepState), typeof(HyperGonerState) }; private readonly Dictionary<Type, float> readyAt = new Dictionary<Type, float>(); private CharacterBody body; private EntityStateMachine weapon; private EntityStateMachine formMachine; private LineRenderer marker; private GameObject markerObject; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private void Update() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!Object.op_Implicit((Object)(object)body) || !((NetworkBehaviour)body).hasAuthority || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive || !Object.op_Implicit((Object)(object)body.inputBank)) { return; } Vector3 point; bool valid = GroundTarget.Find(body, new Ray(body.inputBank.aimOrigin, body.inputBank.aimDirection), out point); Vector3 point2; bool valid2 = GroundTarget.FindGoner(body, new Ray(body.inputBank.aimOrigin, body.inputBank.aimDirection), out point2); if (!Cursor.visible) { UpdateMarker(valid2, point2); } else if (Object.op_Implicit((Object)(object)marker)) { ((Renderer)marker).enabled = false; } if (!Object.op_Implicit((Object)(object)weapon) || !Object.op_Implicit((Object)(object)formMachine)) { EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val in components) { if (val.customName == "Weapon") { weapon = val; } else if (val.customName == "AsrielForm") { formMachine = val; } } } if (Cursor.visible || Time.timeScale <= 0f) { return; } KeyboardShortcut value; if (Object.op_Implicit((Object)(object)formMachine)) { value = AsrielConfig.AwakeningKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { formMachine.SetInterruptState((EntityState)(object)new AwakeningState(), (InterruptPriority)2); } } if (!Object.op_Implicit((Object)(object)weapon) || weapon.state is AsrielState) { return; } value = AsrielConfig.GodstepKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { TryMove(4, valid); } else { if (!AsrielConfig.EnableMoveHotkeys.Value) { return; } for (int j = 0; j < Moves.Length; j++) { if (Input.GetKeyDown((KeyCode)(49 + j))) { TryMove(j, valid); break; } } } } private void TryMove(int index, bool valid) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown Type type = Moves[index]; Vector3 point; if (index == 5) { valid = GroundTarget.FindGoner(body, new Ray(body.inputBank.aimOrigin, body.inputBank.aimDirection), out point); } if (((index == 0 || index == 1 || index == 4 || index == 5) && !valid) || (index == 4 && !GroundTarget.BlinkDestination(body, new Ray(body.inputBank.aimOrigin, body.inputBank.aimDirection), out point)) || (readyAt.TryGetValue(type, out var value) && Time.time < value) || !AsrielContent.MoveDefinitions.TryGetValue(type, out var value2)) { return; } GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[4] { body.skillLocator.primary, body.skillLocator.secondary, body.skillLocator.utility, body.skillLocator.special }; foreach (GenericSkill val in array) { if (Object.op_Implicit((Object)(object)val) && (Object)(object)val.skillDef == (Object)(object)value2) { val.ExecuteIfReady(); return; } } if (weapon.SetInterruptState((EntityState)Activator.CreateInstance(type), (InterruptPriority)2)) { readyAt[type] = Time.time + value2.baseRechargeInterval + CastLength(index); } } private static float CastLength(int index) { return index switch { 4 => 0.35f, 3 => 11.8f, 2 => 10.1f, 1 => 7.3333335f, 0 => 12.2f, _ => 14.6f, }; } private void UpdateMarker(bool valid, Vector3 point) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0064: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (!valid) { if (Object.op_Implicit((Object)(object)marker)) { ((Renderer)marker).enabled = false; } return; } if (!Object.op_Implicit((Object)(object)marker)) { markerObject = new GameObject("AsrielCrosshairTarget"); marker = FxPrimitives.Line(markerObject.transform, "TargetRing", 0.08f, new Color(0.4f, 1f, 0.75f, 0.8f)); marker.positionCount = 49; marker.loop = false; } ((Renderer)marker).enabled = true; for (int i = 0; i < 49; i++) { float num = (float)i * MathF.PI * 2f / 48f; marker.SetPosition(i, point + new Vector3(Mathf.Cos(num) * 1.1f, 0.06f, Mathf.Sin(num) * 1.1f)); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)marker)) { ((Renderer)marker).enabled = false; } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)markerObject)) { Object.Destroy((Object)(object)markerObject); } } } [DefaultExecutionOrder(50)] public sealed class AsrielAnimationDriver : MonoBehaviour { public CharacterBody Body; public GameObject SaberLeft; public GameObject SaberRight; public bool CharacterSelect; private readonly ArtificerMotion mage = new ArtificerMotion(); private float mageWeight; private readonly AsrielGlideArms arms = new AsrielGlideArms(); private readonly ChaosSaberPoseRig saberPose = new ChaosSaberPoseRig(); private bool saberCasting; private bool blasterCasting; private readonly ChaosBlasterPoseRig blasterPose = new ChaosBlasterPoseRig(); private readonly AsrielClipPlayer player = new AsrielClipPlayer(); private readonly AsrielPoseBlend pose = new AsrielPoseBlend(); private readonly AsrielClothMotion cloth = new AsrielClothMotion(); private float locomotionClock; private Transform head; private Transform neck; private float headYaw; private float headPitch; private Animator animator; private string current; private float lockedUntil; private float spawnUntil; private float castAt; private Vector3 gonerAim; private bool grounded = true; private HoverMotion motion; private readonly HashSet<string> missing = new HashSet<string>(); private Transform gonerLeft; private Transform gonerRight; private Transform gonerLeftHand; private Transform gonerRightHand; private void Awake() { animator = ((Component)this).GetComponent<Animator>(); spawnUntil = Time.time + 1.5f; BindPose(); if (Object.op_Implicit((Object)(object)animator)) { animator.applyRootMotion = false; animator.updateMode = (AnimatorUpdateMode)0; animator.cullingMode = (AnimatorCullingMode)0; animator.speed = 1f; } } private void Start() { if (!CharacterSelect && !Object.op_Implicit((Object)(object)Body)) { Body = ((Component)this).GetComponentInParent<CharacterBody>(); } Play((CharacterSelect || !Object.op_Implicit((Object)(object)Body)) ? "LobbyIdle" : "Spawn", 1f, restart: true); } internal void Cast(string clip, float duration, float authoredDuration) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) spawnUntil = 0f; arms.BeginCast(); if (clip == "HyperGoner" && Object.op_Implicit((Object)(object)Body) && Object.op_Implicit((Object)(object)Body.inputBank)) { Vector3 aimDirection = Body.inputBank.aimDirection; gonerAim = ((Vector3)(ref aimDirection)).normalized; } castAt = Time.time; lockedUntil = Time.time + duration; saberCasting = clip == "ChaosSabers"; blasterCasting = clip == "ChaosBlaster"; if (saberCasting) { saberPose.Bind(((Component)this).transform, Object.op_Implicit((Object)(object)BattleAssets.Model) ? BattleAssets.Model.transform : null, SaberLeft, SaberRight); MobileCastLocomotion(); } else if (blasterCasting) { blasterPose.Bind(((Component)this).transform, Object.op_Implicit((Object)(object)BattleAssets.Model) ? BattleAssets.Model.transform : null); MobileCastLocomotion(); } else { Play(clip, authoredDuration / Mathf.Max(0.05f, duration), restart: true, 0.2f); } } internal void EndCast() { pose.Begin(0.28f); saberPose.Clear(); blasterPose.Clear(); saberCasting = (blasterCasting = false); lockedUntil = 0f; ShowSabers(show: false); } private void MobileCastLocomotion() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) CharacterMotor val = (Object.op_Implicit((Object)(object)Body) ? Body.characterMotor : null); if (!Object.op_Implicit((Object)(object)val)) { Play("Idle"); return; } Vector3 val2 = Vector3.ProjectOnPlane(val.velocity, Vector3.up); float magnitude = ((Vector3)(ref val2)).magnitude; motion = HoverPlan.Select(magnitude, motion, Body.isSprinting); AsrielFlight component = ((Component)Body).GetComponent<AsrielFlight>(); bool flag = Object.op_Implicit((Object)(object)component) && component.Active; Play((!val.isGrounded && !flag && !val.isFlying) ? "JumpLoop" : HoverPlan.Clip(motion), 1f, restart: false, 0.22f, synchronize: true); grounded = val.isGrounded; } internal void ShowSabers(bool show) { if (Object.op_Implicit((Object)(object)SaberLeft)) { SaberLeft.SetActive(show); } if (Object.op_Implicit((Object)(object)SaberRight)) { SaberRight.SetActive(show); } } private void Play(string clip, float rate = 1f, bool restart = false, float fade = 0.22f, bool synchronize = false) { if (!Object.op_Implicit((Object)(object)animator)) { return; } if (!player.Valid) { if (BattleAssets.Clips.Count == 0) { return; } player.Create(animator); current = null; } if (current == clip && !restart) { return; } double offset = ((synchronize && HoverPlan.IsLoop(clip)) ? ((HoverPlan.IsLoop(current) ? player.Time : ((double)locomotionClock)) % 2.799999952316284) : 0.0); if (!player.Play(clip, rate, restart, fade, offset)) { if (missing.Add(clip)) { AsrielPlugin.Log.LogError((object)("Animation clip missing: " + clip + ". Rebuild the 0.18.0 Unity bundle and install it with the DLL.")); } return; } if (clip != "LobbyIdle" && (HoverPlan.IsLoop(clip) || clip == "JumpLoop")) { pose.Begin(fade); } else { pose.CancelBlend(); } current = clip; } private void Update() { //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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)animator) || Time.deltaTime <= 0f) { return; } pose.RestoreBase(); locomotionClock = Mathf.Repeat(locomotionClock + Time.deltaTime, 2.8f); animator.speed = 1f; if (CharacterSelect || !Object.op_Implicit((Object)(object)Body)) { Play("LobbyIdle"); } else if (Object.op_Implicit((Object)(object)Body.healthComponent) && !Body.healthComponent.alive) { ShowSabers(show: false); Play("Death", 1f, restart: false, 0.2f); } else if (Time.time < lockedUntil) { if (saberCasting || blasterCasting) { MobileCastLocomotion(); } } else if (Time.time < spawnUntil) { Play("Spawn"); } else { CharacterMotor characterMotor = Body.characterMotor; if (!Object.op_Implicit((Object)(object)characterMotor)) { Play("Idle"); } else { bool isGrounded = characterMotor.isGrounded; Vector3 val = Vector3.ProjectOnPlane(characterMotor.velocity, Vector3.up); float magnitude = ((Vector3)(ref val)).magnitude; AsrielFlight component = ((Component)Body).GetComponent<AsrielFlight>(); if ((Object.op_Implicit((Object)(object)component) && component.Active) || characterMotor.isFlying) { motion = HoverPlan.Select(magnitude, motion, Body.isSprinting); Play(HoverPlan.Clip(motion), 1f, restart: false, 0.3f, synchronize: true); } else if (!isGrounded) { if (grounded) { Play("JumpStart", 1f, restart: true, 0.15f); lockedUntil = Time.time + 0.3f; } else { Play("JumpLoop"); } } else if (!grounded) { Play("JumpEnd", 1f, restart: true, 0.18f); lockedUntil = Time.time + 0.35f; } else { motion = HoverPlan.Select(magnitude, motion, Body.isSprinting); Play(HoverPlan.Clip(motion), 1f, restart: false, 0.35f, synchronize: true); } grounded = isGrounded; } } player.Tick(Time.deltaTime); } private void LateUpdate() { //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: 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_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0321: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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_0268: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)animator) || Time.deltaTime <= 0f) { return; } pose.CaptureBase(); if (CharacterSelect || !Object.op_Implicit((Object)(object)Body)) { arms.Apply(((Component)this).transform, HoverMotion.Idle, 0f, Time.deltaTime); FinishPose(settled: false); return; } if (!Object.op_Implicit((Object)(object)Body.healthComponent) || !Body.healthComponent.alive) { FinishPose(settled: true); return; } bool flag = Time.time < lockedUntil; bool flag2 = (!flag || saberCasting || blasterCasting) && (HoverPlan.IsLoop(current) || current == "JumpLoop"); if (flag && !saberCasting && !blasterCasting) { mageWeight = 0f; } else { mageWeight = Mathf.MoveTowards(mageWeight, flag2 ? 1f : 0f, Time.deltaTime * 5f); } if (mageWeight > 0f && mage.Create(((Component)this).transform)) { AsrielFlight component = ((Component)Body).GetComponent<AsrielFlight>(); mage.Apply(motion, Object.op_Implicit((Object)(object)component) && component.Active, (flag && !saberCasting && !blasterCasting) ? 0f : Time.deltaTime, mageWeight); } if (flag) { if (saberCasting) { saberPose.Apply(((Component)this).transform, Time.time - castAt); } else if (blasterCasting) { CharacterMotor characterMotor = Body.characterMotor; float forward = Mathf.Clamp01(Vector3.Dot(Object.op_Implicit((Object)(object)characterMotor) ? Vector3.ProjectOnPlane(characterMotor.velocity, Vector3.up) : Vector3.zero, ((Component)this).transform.forward) / Mathf.Max(1f, Body.moveSpeed)); arms.Apply(((Component)this).transform, motion, forward, Time.deltaTime); blasterPose.Apply(((Component)this).transform, Object.op_Implicit((Object)(object)Body.inputBank) ? Body.inputBank.aimDirection : ((Component)this).transform.forward, Time.time - castAt, Time.deltaTime); AimHead(); } arms.BlendCast(Time.time - castAt); if (current == "HyperGoner") { AimGonerHands(); } FinishPose(!saberCasting && !blasterCasting); } else if (!flag2) { FinishPose(settled: true); } else { CharacterMotor characterMotor2 = Body.characterMotor; float forward2 = Mathf.Clamp01(Vector3.Dot(Object.op_Implicit((Object)(object)characterMotor2) ? Vector3.ProjectOnPlane(characterMotor2.velocity, Vector3.up) : Vector3.zero, ((Component)this).transform.forward) / Mathf.Max(1f, Body.moveSpeed)); arms.Apply(((Component)this).transform, motion, forward2, Time.deltaTime); AimHead(); saberPose.BlendOut(Time.deltaTime); blasterPose.BlendOut(Time.deltaTime); FinishPose(settled: false); } } private void BindPose() { pose.Bind((from b in ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(true).SelectMany((SkinnedMeshRenderer r) => r.bones) where Object.op_Implicit((Object)(object)b) && (Object)(object)b != (Object)(object)((Component)this).transform select b).Distinct().ToArray()); } private void FinishPose(bool settled) { //IL_0038: 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) CharacterMotor val = (Object.op_Implicit((Object)(object)Body) ? Body.characterMotor : null); cloth.Apply(((Component)this).transform, Object.op_Implicit((Object)(object)val) ? val.velocity : Vector3.zero, Object.op_Implicit((Object)(object)Body) ? Body.moveSpeed : 1f, Time.deltaTime, settled); pose.Apply(Time.deltaTime); } private void AimHead() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)head)) { head = BattleAssets.Bone(((Component)this).transform, "Head"); neck = BattleAssets.Bone(((Component)this).transform, "Neck"); } if (Object.op_Implicit((Object)(object)head) && Object.op_Implicit((Object)(object)Body.inputBank)) { Transform transform = ((Component)this).transform; Vector3 aimDirection = Body.inputBank.aimDirection; Vector3 val = transform.InverseTransformDirection(((Vector3)(ref aimDirection)).normalized); float num = Mathf.Clamp(Mathf.Atan2(val.x, val.z) * 57.29578f, -45f, 45f); float num2 = Mathf.Clamp((0f - Mathf.Asin(Mathf.Clamp(val.y, -1f, 1f))) * 57.29578f, -28f, 28f); float num3 = 1f - Mathf.Exp((0f - Time.deltaTime) * 7f); headYaw = Mathf.Lerp(headYaw, num, num3); headPitch = Mathf.Lerp(headPitch, num2, num3); if (Object.op_Implicit((Object)(object)neck)) { Transform obj = neck; obj.localRotation *= Quaternion.Euler(headPitch * 0.35f, headYaw * 0.35f, 0f); } Transform obj2 = head; obj2.localRotation *= Quaternion.Euler(headPitch * 0.65f, headYaw * 0.65f, 0f); } } private void OnDisable() { cloth.Reset(); pose.RestoreBase(); pose.Reset(); saberPose.Clear(); blasterPose.Clear(); saberCasting = (blasterCasting = false); mage.Reset(); arms.Reset(); player.Destroy(); current = null; lockedUntil = 0f; ShowSabers(show: false); } private void OnEnable() { BindPose(); } private void OnDestroy() { mage.Destroy(); player.Destroy(); } private void AimGonerHands() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00e9: 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_010d: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0142: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Body.inputBank)) { return; } if (!Object.op_Implicit((Object)(object)gonerLeft)) { gonerLeft = BattleAssets.Bone(((Component)this).transform, "UpperArm.L"); gonerRight = BattleAssets.Bone(((Component)this).transform, "UpperArm.R"); gonerLeftHand = BattleAssets.Bone(((Component)this).transform, "Hand.L"); gonerRightHand = BattleAssets.Bone(((Component)this).transform, "Hand.R"); } if (!Object.op_Implicit((Object)(object)gonerLeft) || !Object.op_Implicit((Object)(object)gonerRight) || !Object.op_Implicit((Object)(object)gonerLeftHand) || !Object.op_Implicit((Object)(object)gonerRightHand)) { return; } float num = HyperGonerPlan.HandsForward(Time.time - castAt); if (num <= 0f) { return; } Vector3 val = gonerAim; if (!(((Vector3)(ref val)).sqrMagnitude < 0.5f)) { Vector3 val2 = Vector3.ProjectOnPlane(val, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = ((Component)this).transform.forward; } Quaternion val4 = Quaternion.Slerp(Quaternion.identity, Quaternion.FromToRotation(val3, val), num); gonerLeft.rotation = val4 * gonerLeft.rotation; gonerRight.rotation = val4 * gonerRight.rotation; } } } public sealed class AsrielAtmosphere : MonoBehaviour { private struct LightState { public Light Light; public Color Original; public Color Written; public bool Owns; } private static AsrielAtmosphere instance; private readonly AtmosphereTimeline timeline = new AtmosphereTimeline(); private readonly List<LightState> lights = new List<LightState>(); private readonly List<AsrielAtmosphereCamera> cameras = new List<AsrielAtmosphereCamera>(); private int sceneHandle; private bool captured; private bool wroteSettings; private bool ownsSky; private bool ownsEquator; private bool ownsGround; private bool ownsFog; private Color sky; private Color equator; private Color ground; private Color fog; private Color lastSky; private Color lastEquator; private Color lastGround; private Color lastFog; private AtmosphereTimeline.Frame frame; internal float Strength; internal float Phase; internal float Impact; internal float Cycle; internal static void Receive(CosmicMessage message) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (AsrielConfig.EnableRainbowAtmosphere.Value) { if (!Object.op_Implicit((Object)(object)instance)) { GameObject val = new GameObject("AsrielRainbowAtmosphere"); Object.DontDestroyOnLoad((Object)val); instance = val.AddComponent<AsrielAtmosphere>(); } float time = Time.time; if (message.Kind == CosmicKind.AtmosphereStart) { instance.timeline.Begin(message.Id, time, message.Life); } else if (message.Kind == CosmicKind.AtmosphereImpact) { instance.timeline.MarkImpact(message.Id, time); } else { instance.timeline.End(message.Id, time); } } } internal static void Shutdown() { if (Object.op_Implicit((Object)(object)instance)) { instance.ResetEffect(); Object.Destroy((Object)(object)((Component)instance).gameObject); instance = null; } } private void OnEnable() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnCamera)); SceneManager.activeSceneChanged += SceneChanged; SceneManager.sceneUnloaded += SceneUnloaded; } private void OnDisable() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnCamera)); SceneManager.activeSceneChanged -= SceneChanged; SceneManager.sceneUnloaded -= SceneUnloaded; ResetEffect(); } private void OnDestroy() { if ((Object)(object)instance == (Object)(object)this) { instance = null; } } private void SceneChanged(Scene oldScene, Scene newScene) { ResetEffect(); } private void SceneUnloaded(Scene scene) { if (captured && ((Scene)(ref scene)).handle == sceneHandle) { ResetEffect(); } } private void LateUpdate() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c8: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_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_02ca: Unknown result type (might be due to invalid IL or missing references) if (!AsrielConfig.EnableRainbowAtmosphere.Value) { ResetEffect(); return; } frame = timeline.Sample(Time.time); if (timeline.Count == 0) { Restore(); return; } if (!captured) { Capture(); } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).handle != sceneHandle) { ResetEffect(); return; } Strength = frame.Strength * AtmosphereTimeline.Bound(AsrielConfig.AtmosphereIntensity.Value, 0.85f, 0f, 1f); Phase = frame.PhaseSeconds; Impact = frame.Impact; Cycle = AtmosphereTimeline.Bound(AsrielConfig.AtmosphereCycleSeconds.Value, 5.5f, 3f, 16f); Color hue = Color.HSVToRGB(Mathf.Repeat(Phase / Cycle, 1f), 0.8f, 1f); float amount = Strength * 0.6f; if (wroteSettings) { ownsSky &= Same(RenderSettings.ambientSkyColor, lastSky); ownsEquator &= Same(RenderSettings.ambientEquatorColor, lastEquator); ownsGround &= Same(RenderSettings.ambientGroundColor, lastGround); ownsFog &= Same(RenderSettings.fogColor, lastFog); } lastSky = Tint(sky, hue, amount); lastEquator = Tint(equator, hue, amount); lastGround = Tint(ground, hue, amount); lastFog = Tint(fog, hue, Strength * 0.72f); if (ownsSky) { RenderSettings.ambientSkyColor = lastSky; } if (ownsEquator) { RenderSettings.ambientEquatorColor = lastEquator; } if (ownsGround) { RenderSettings.ambientGroundColor = lastGround; } if (ownsFog) { RenderSettings.fogColor = lastFog; } wroteSettings = true; for (int i = 0; i < lights.Count; i++) { LightState value = lights[i]; if (Object.op_Implicit((Object)(object)value.Light)) { if (value.Owns && !Same(value.Light.color, value.Written)) { value.Owns = false; lights[i] = value; } else if (value.Owns) { value.Written = Tint(value.Original, hue, Strength * 0.5f); value.Light.color = value.Written; lights[i] = value; } } } } private void Capture() { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); sceneHandle = ((Scene)(ref activeScene)).handle; captured = true; ownsSky = (ownsEquator = (ownsGround = (ownsFog = true))); sky = RenderSettings.ambientSkyColor; equator = RenderSettings.ambientEquatorColor; ground = RenderSettings.ambientGroundColor; fog = RenderSettings.fogColor; Light[] array = Object.FindObjectsOfType<Light>(); foreach (Light val in array) { if ((int)val.type == 1 && (val.cullingMask & LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)) != 0) { lights.Add(new LightState { Light = val, Original = val.color, Written = val.color, Owns = true }); } } } private static Color Tint(Color value, Color hue, float amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) float num = (hue.r + hue.g + hue.b) / 3f; Color val = Color.Lerp(Color.white, new Color(hue.r / num, hue.g / num, hue.b / num, 1f), amount); Color result = value * val; result.a = value.a; return result; } private static bool Same(Color a, Color b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Mathf.Abs(a.r - b.r) < 0.0001f && Mathf.Abs(a.g - b.g) < 0.0001f && Mathf.Abs(a.b - b.b) < 0.0001f) { return Mathf.Abs(a.a - b.a) < 0.0001f; } return false; } private void OnCamera(Camera camera) { } private void ResetEffect() { timeline.Clear(); Restore(); } private void Restore() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_00ed: 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_0112: Unknown result type (might be due to invalid IL or missing references) Strength = (Impact = 0f); foreach (AsrielAtmosphereCamera camera in cameras) { if (Object.op_Implicit((Object)(object)camera)) { camera.Release(); } } cameras.Clear(); if (!captured) { return; } if (wroteSettings) { Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).handle == sceneHandle) { if (ownsSky && Same(RenderSettings.ambientSkyColor, lastSky)) { RenderSettings.ambientSkyColor = sky; } if (ownsEquator && Same(RenderSettings.ambientEquatorColor, lastEquator)) { RenderSettings.ambientEquatorColor = equator; } if (ownsGround && Same(RenderSettings.ambientGroundColor, lastGround)) { RenderSettings.ambientGroundColor = ground; } if (ownsFog && Same(RenderSettings.fogColor, lastFog)) { RenderSettings.fogColor = fog; } } } foreach (LightState light in lights) { if (Object.op_Implicit((Object)(object)light.Light) && light.Owns && Same(light.Light.color, light.Written)) { light.Light.color = light.Original; } } lights.Clear(); captured = (wroteSettings = false); } } public sealed class AsrielAtmosphereCamera : MonoBehaviour { private AsrielAtmosphere owner; private Material material; private DepthTextureMode priorDepth; private DepthTextureMode requestedDepth; internal Camera Target { get; private set; } internal void Initialize(AsrielAtmosphere controller, Camera camera) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown owner = controller; Target = camera; priorDepth = camera.depthTextureMode; requestedDepth = (DepthTextureMode)(priorDepth | 1); camera.depthTextureMode = requestedDepth; material = new Material(BattleAssets.AtmosphereMaterial) { hideFlags = (HideFlags)61 }; } [ImageEffectOpaque] private void OnRenderImage(RenderTexture source, RenderTexture destination) { Graphics.Blit((Texture)(object)source, destination); } internal void Release() { ((Behaviour)this).enabled = false; Cleanup(); Object.Destroy((Object)(object)this); } private void OnDestroy() { Cleanup(); } private void Cleanup() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Target) && Target.depthTextureMode == requestedDepth) { Target.depthTextureMode = priorDepth; } if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); material = null; } owner = null; Target = null; } } internal static class AsrielAudioLevels { private static volatile float effects = 0.7f; private static volatile float music = 0.55f; internal static void Set(float soundEffects, float awakeningMusic, bool enabled) { effects = (enabled ? Bound(soundEffects) : 0f); music = (enabled ? Bound(awakeningMusic) : 0f); } internal static float Gain(bool theme) { if (!theme) { return effects; } return music; } private static float Bound(float value) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Math.Max(0f, Math.Min(1f, value)); } return 0f; } } public sealed class AwakeningState : BaseState { public override void OnEnter() { ((BaseState)this).OnEnter(); if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { AsrielAwakening component = ((Component)((EntityState)this).characterBody).GetComponent<AsrielAwakening>(); if (Object.op_Implicit((Object)(object)component)) { component.Toggle(); } } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } } [DefaultExecutionOrder(110)] public sealed class AsrielAwakening : MonoBehaviour { private CharacterBody body; private Transform hips; private GameObject aura; private MeshRenderer[] flames; private MeshRenderer[] motes; private Mesh flameMesh; private uint ownerId; private float nextPublish; private float startedAt; private Quaternion hipsRestFrame = Quaternion.identity; private readonly AwakeningStats stats = new AwakeningStats(); private readonly MaterialPropertyBlock block = new MaterialPropertyBlock(); internal bool Active { get; private set; } private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } internal static void Receive(CosmicMessage message) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject val = ClientScene.FindLocalObject(new NetworkInstanceId(message.Id)); if (!Object.op_Implicit((Object)(object)val) && NetworkServer.active) { val = NetworkServer.FindLocalObject(new NetworkInstanceId(message.Id)); } if (Object.op_Implicit((Object)(object)val)) { AsrielAwakening component = val.GetComponent<AsrielAwakening>(); if (Object.op_Implicit((Object)(object)component)) { component.Apply(message.Life > 0.5f); } } } internal void Toggle() { //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) Apply(!Active); if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && ownerId != 0) { CosmicMessage.Broadcast(CosmicKind.Awakening, body.corePosition, Vector3.zero, Active ? 1f : 0f, 1f, ownerId); } } internal void Apply(bool active) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_01b4: 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_0138: Unknown result type (might be due to invalid IL or missing references) if (Active == active) { return; } stats.Apply(body, active); Active = active; NetworkIdentity component = ((Component)this).GetComponent<NetworkIdentity>(); int num; if (!Object.op_Implicit((Object)(object)component)) { num = 0; } else { NetworkInstanceId netId = component.netId; num = (int)((NetworkInstanceId)(ref netId)).Value; } ownerId = (uint)num; if (!active) { DestroyAura(); ReferenceAudio.StopTheme(ownerId); return; } startedAt = Time.time; if ((int)SystemInfo.graphicsDeviceType != 4) { aura = new GameObject("AsrielRainbowFlameAwakening"); flames = (MeshRenderer[])(object)new MeshRenderer[2]; motes = (MeshRenderer[])(object)new MeshRenderer[32]; flameMesh = AwakeningFlameGeometry.Build(); for (int i = 0; i < flames.Length; i++) { flames[i] = FxPrimitives.Mesh(aura.transform, "RisingRainbowFlames", flameMesh, BattleAssets.AwakeningFlameMaterial); ((Component)flames[i]).transform.localScale = new Vector3((i == 0) ? 1f : 0.87f, (i == 0) ? 1f : 0.93f, (i == 0) ? 1f : 0.87f); ((Component)flames[i]).transform.localRotation = Quaternion.Euler(0f, (float)i * 6.4286f, 0f); } for (int j = 0; j < motes.Length; j++) { motes[j] = FxPrimitives.Mesh(aura.transform, "RisingAuraSpark", FxPrimitives.Star, BattleAssets.RainbowMaterial); } if (Object.op_Implicit((Object)(object)body) && ((NetworkBehaviour)body).hasAuthority) { ReferenceAudio.PlayTheme(ownerId, body.corePosition); } } } private void LateUpdate() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return; } if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { Apply(active: false); return; } if (NetworkServer.active && Time.time >= nextPublish) { nextPublish = Time.time + 0.75f; if (ownerId != 0) { CosmicMessage.Broadcast(CosmicKind.Awakening, body.corePosition, Vector3.zero, 1f, 1f, ownerId); } } if (!Object.op_Implicit((Object)(object)aura)) { return; } float time = Time.time; float num = Mathf.SmoothStep(0f, 1f, (time - startedAt) / 0.35f); Vector3 position = body.footPosition; if (!Object.op_Implicit((Object)(object)hips)) { ModelLocator component = ((Component)body).GetComponent<ModelLocator>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform)) { hips = BattleAssets.Bone(component.modelTransform, "Hips"); } Transform val = (Object.op_Implicit((Object)(object)BattleAssets.Model) ? BattleAssets.Bone(BattleAssets.Model.transform, "Hips") : null); if (Object.op_Implicit((Object)(object)val)) { hipsRestFrame = Quaternion.Inverse(BattleAssets.Model.transform.rotation) * val.rotation; } } if (Object.op_Implicit((Object)(object)hips)) { aura.transform.rotation = AuraFollowPlan.Rotation(hips.rotation, hipsRestFrame); position = AuraFollowPlan.Origin(hips.position, body.footPosition, aura.transform.rotation); } aura.transform.position = position; Camera viewCamera = FxPrimitives.ViewCamera; block.Clear(); block.SetFloat("_FxTime", time); block.SetFloat("_Fade", num); for (int i = 0; i < flames.Length; i++) { block.SetFloat("_Seed", (float)i * 0.47f); ((Renderer)flames[i]).SetPropertyBlock(block); } for (int j = 0; j < motes.Length; j++) { float num2 = (float)j * 2.399963f; float num3 = Mathf.Repeat(time * 2f + (float)j * 0.137f, 4.4f); ((Component)motes[j]).transform.localPosition = new Vector3(Mathf.Cos(num2) * (1.05f + 0.12f * Mathf.Sin(num3 * 2f + (float)j)), num3, Mathf.Sin(num2) * (1.05f + 0.12f * Mathf.Sin(num3 * 2f + (float)j))); ((Component)motes[j]).transform.localScale = new Vector3(0.035f, 0.1f, 0.035f) * (1f - num3 / 5f); if (Object.op_Implicit((Object)(object)viewCamera)) { ((Component)motes[j]).transform.rotation = AuraFollowPlan.Billboard(((Component)viewCamera).transform.forward, aura.transform.up, ((Component)viewCamera).transform.up); } block.SetFloat("_Seed", (float)j * 0.137f); block.SetFloat("_Fade", num * (1f - Mathf.SmoothStep(0f, 1f, (num3 - 3.5f) / 0.9f))); ((Renderer)motes[j]).SetPropertyBlock(block); } } private void DestroyAura() { if (Object.op_Implicit((Object)(object)aura)) { Object.Destroy((Object)(object)aura); } aura = null; if (Object.op_Implicit((Object)(object)flameMesh)) { Object.Destroy((Object)(object)flameMesh); } flameMesh = null; flames = null; motes = null; } private void OnDisable() { if (Active) { Apply(active: false); } } private void OnDestroy() { stats.Apply(body, active: false); DestroyAura(); ReferenceAudio.StopTheme(ownerId); } } internal sealed class AsrielClipPlayer { private PlayableGraph graph; private AnimationMixerPlayable mixer; private readonly Dictionary<string, int> slots = new Dictionary<string, int>(); private AnimationClipPlayable[] clips; private float[] weights; private float[] starts; private int target = -1; private float elapsed; private float duration; private bool holding; internal bool Valid => ((PlayableGraph)(ref graph)).IsValid(); internal double Time { get { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (target >= 0) { return PlayableExtensions.GetTime<AnimationClipPlayable>(clips[target]); } return 0.0; } } internal string Current { get; private set; } internal void Create(Animator animator) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) Destroy(); slots.Clear(); int count = BattleAssets.Clips.Count; graph = PlayableGraph.Create("AsrielIsolatedAnimation"); ((PlayableGraph)(ref graph)).SetTimeUpdateMode((DirectorUpdateMode)1); mixer = AnimationMixerPlayable.Create(graph, count); clips = (AnimationClipPlayable[])(object)new AnimationClipPlayable[count]; weights = new float[count]; starts = new float[count]; int num = 0; foreach (KeyValuePair<string, AnimationClip> clip in BattleAssets.Clips) { slots.Add(clip.Key, num); clips[num] = AnimationClipPlayable.Create(graph, clip.Value); ((AnimationClipPlayable)(ref clips[num])).SetApplyFootIK(false); ((AnimationClipPlayable)(ref clips[num])).SetApplyPlayableIK(false); PlayableExtensions.SetSpeed<AnimationClipPlayable>(clips[num], 0.0); ((PlayableGraph)(ref graph)).Connect<AnimationClipPlayable, AnimationMixerPlayable>(clips[num], 0, mixer, num); num++; } PlayableOutputExtensions.SetSourcePlayable<AnimationPlayableOutput, AnimationMixerPlayable>(AnimationPlayableOutput.Create(graph, "AsrielPose", animator), mixer); ((PlayableGraph)(ref graph)).Play(); } internal bool Play(string name, float rate, bool restart, float fade, double offset = 0.0) { //IL_00ff: 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_00ab: Unknown result type (might be due to invalid IL or missing references) if (!Valid || !slots.TryGetValue(name, out var value)) { return false; } if (Current == name && !restart && !holding) { return true; } holding = false; for (int i = 0; i < weights.Length; i++) { starts[i] = weights[i]; } if (target < 0) { weights[value] = (starts[value] = 1f); fade = 0f; } if (!HoverPlan.IsLoop(name) && name != "JumpLoop") { for (int j = 0; j < clips.Length; j++) { if (j != value) { PlayableExtensions.SetSpeed<AnimationClipPlayable>(clips[j], 0.0); } } } target = value; Current = name; elapsed = 0f; duration = Mathf.Max(0.001f, fade); PlayableExtensions.SetTime<AnimationClipPlayable>(clips[value], offset); PlayableExtensions.SetSpeed<AnimationClipPlayable>(clips[value], (double)Mathf.Max(0.01f, rate)); Tick(0f); return true; } internal void Tick(float delta) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!Valid || target < 0) { return; } elapsed += delta; float num = Mathf.SmoothStep(0f, 1f, elapsed / duration); for (int i = 0; i < weights.Length; i++) { weights[i] = Mathf.Lerp(starts[i], (float)((i == target) ? 1 : 0), num); PlayableExtensions.SetInputWeight<AnimationMixerPlayable>(mixer, i, weights[i]); if (i != target && weights[i] < 1E-05f) { PlayableExtensions.SetSpeed<AnimationClipPlayable>(clips[i], 0.0); } } } internal void Hold(string name, double seconds) { //IL_0029: 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) if (Play(name, 1f, restart: true, 0.2f)) { PlayableExtensions.SetTime<AnimationClipPlayable>(clips[target], seconds); PlayableExtensions.SetSpeed<AnimationClipPlayable>(clips[target], 0.0); holding = true; } } internal void Destroy() { if (((PlayableGraph)(ref graph)).IsValid()) { ((PlayableGraph)(ref graph)).Destroy(); } target = -1; Current = null; holding = false; } } internal sealed class AsrielClothMotion { private readonly Transform[] roots = (Transform[])(object)new Transform[4]; private readonly Transform[] tips = (Transform[])(object)new Transform[4]; private bool ready; private bool headingReady; private Vector3 previousForward; private float pitch; private float roll; private float pitchVelocity; private float rollVelocity; private float clock; private void Bind(Transform root) { if (!ready) { string[] array = new string[4] { "RobeFront.L", "RobeFront.R", "RobeBack.L", "RobeBack.R" }; for (int i = 0; i < 4; i++) { roots[i] = BattleAssets.Bone(root, array[i]); tips[i] = BattleAssets.Bone(root, array[i] + ".Tip"); } ready = true; } } internal void Apply(Transform root, Vector3 velocity, float moveSpeed, float delta, bool settled) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) Bind(root); delta = Mathf.Clamp(delta, 0f, 0.1f); if (delta <= 0f) { return; } Vector3 val = root.InverseTransformDirection(velocity) / Mathf.Max(1f, moveSpeed); float num = (headingReady ? (Vector3.SignedAngle(previousForward, root.forward, Vector3.up) / delta) : 0f); previousForward = root.forward; headingReady = true; float num2 = (settled ? 0f : ((0f - Mathf.Clamp(val.z, -1f, 1f)) * 8f)); float num3 = (settled ? 0f : ((0f - Mathf.Clamp(val.x, -1f, 1f)) * 5f - Mathf.Clamp(num / 180f, -1f, 1f) * 3f)); pitch = Mathf.SmoothDamp(pitch, num2, ref pitchVelocity, 0.24f, float.PositiveInfinity, delta); roll = Mathf.SmoothDamp(roll, num3, ref rollVelocity, 0.28f, float.PositiveInfinity, delta); clock = Mathf.Repeat(clock + delta, 2.8f); for (int i = 0; i < 4; i++) { float num4 = Mathf.Sin(clock * 2.243995f + (float)i * 0.48f) * (settled ? 0.1f : 0.65f); Quaternion val2 = Quaternion.AngleAxis(pitch + num4, root.right) * Quaternion.AngleAxis(roll, root.forward); if (Object.op_Implicit((Object)(object)roots[i])) { roots[i].rotation = val2 * roots[i].rotation; } if (Object.op_Implicit((Object)(object)tips[i])) { tips[i].rotation = Quaternion.AngleAxis(pitch * 0.4f + num4 * 0.7f, root.right) * Quaternion.AngleAxis(roll * 0.35f, root.forward) * tips[i].rotation; } } } internal void Reset() { ready = (headingReady = false); pitch = (roll = (pitchVelocity = (rollVelocity = (clock = 0f)))); } } internal static class AsrielConfig { internal static ConfigEntry<float> DamageScale { get; private set; } internal static ConfigEntry<float> CooldownScale { get; private set; } internal static ConfigEntry<bool> EnableVerboseLogging { get; private set; } internal static ConfigEntry<int> StarBarrageProjectileCount { get; private set; } internal static ConfigEntry<float> StarBarrageDurationSeconds { get; private set; } internal static ConfigEntry<int> StarShardsPerExplosion { get; private set; } internal static ConfigEntry<float> StarProjectileDamagePercent { get; private set; } internal static ConfigEntry<float> StarShardDamagePercent { get; private set; } internal static ConfigEntry<float> StarShardImpactRadiusMeters { get; private set; } internal static ConfigEntry<float> StarFinalImpactDamagePercent { get; private set; } internal static ConfigEntry<float> StarFinalShockwaveDamagePercent { get; private set; } internal static ConfigEntry<float> StarFinalImpactRadiusMeters { get; private set; } internal static ConfigEntry<int> StarFinalImpactEchoCount { get; private set; } internal static ConfigEntry<float> StarFinalImpactEchoIntervalSeconds { get; private set; } internal static ConfigEntry<float> StarRainSpread { get; private set; } internal static ConfigEntry<float> LightningRadius { get; private set; } internal static ConfigEntry<float> LightningDamagePercent { get; private set; } internal static ConfigEntry<float> LightningLargeDamagePercent { get; private set; } internal static ConfigEntry<bool> EnableReferenceAudio { get; private set; } internal static ConfigEntry<float> ReferenceAudioVolume { get; private set; } internal static ConfigEntry<float> SoundEffectsVolume { get; private set; } internal static ConfigEntry<int> MaxEffectLights { get; private set; } internal static ConfigEntry<bool> FinisherShadows { get; private set; } internal static ConfigEntry<bool> EnableRainbowAtmosphere { get; private set; } internal static ConfigEntry<float> AtmosphereIntensity { get; private set; } internal static ConfigEntry<float> AtmosphereCycleSeconds { get; private set; } internal static ConfigEntry<float> TargetingRange { get; private set; } internal static ConfigEntry<KeyboardShortcut> AwakeningKey { get; private set; } internal static ConfigEntry<KeyboardShortcut> GodstepKey { get; private set; } internal static ConfigEntry<bool> EnableMoveHotkeys { get; private set; } internal static ConfigEntry<float> AwakeningMusicVolume { get; private set; } internal static ConfigEntry<bool> UseArtificerAnimations { get; private set; } internal static ConfigEntry<float> GonerRange { get; private set; } internal static ConfigEntry<float> AwakeningHealthMultiplier { get; private set; } internal static ConfigEntry<float> AwakeningDamageMultiplier { get; private set; } internal static ConfigEntry<float> AwakeningArmorBonus { get; private set; } internal static ConfigEntry<float> AwakeningMoveMultiplier { get; private set; } internal static ConfigEntry<float> AwakeningAttackMultiplier { get; private set; } internal static ConfigEntry<bool> EnableFlight { get; private set; } internal static ConfigEntry<float> FlightSpeedMultiplier { get; private set; } internal static ConfigEntry<KeyboardShortcut> FlightDescendKey { get; private set; } internal static void Initialize(ConfigFile config) { //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0204: 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_02bd: Expected O, but got Unknown //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) bool flag = false; UseArtificerAnimations = config.Bind<bool>("Animation", "UseArtificerAnimations", true, "Retarget the installed Mage/Artificer locomotion onto Asriel at runtime. Custom attack poses are preserved. If the installed Mage rig cannot be mapped, log the reason and use included glide clips."); GonerRange = config.Bind<float>("Hyper Goner", "MaximumRangeMeters", 20000f, "Maximum beam and activation range. Default 20000 m; configurable from 100 to 100000 m. Enemies do not shorten the beam; solid terrain blocks it."); ConfigEntry<int> val = config.Bind<int>("Hyper Goner", "RangeRevision", 0, "Automatic one-time range upgrade. Later manual range edits are retained."); if (val.Value < 186) { if (float.IsNaN(GonerRange.Value) || float.IsInfinity(GonerRange.Value) || GonerRange.Value < 20000f) { GonerRange.Value = 20000f; } val.Value = 186; flag = true; } AwakeningHealthMultiplier = config.Bind<float>("Awakening", "HealthMultiplier", 1.5f, "Multiply base and per-level max health while awakened. Health percentage is preserved on each toggle."); AwakeningDamageMultiplier = config.Bind<float>("Awakening", "DamageMultiplier", 2f, "Multiply base and per-level damage while awakened."); AwakeningArmorBonus = config.Bind<float>("Awakening", "ArmorBonus", 100f, "Additional armor while awakened."); AwakeningMoveMultiplier = config.Bind<float>("Awakening", "MoveSpeedMultiplier", 1.25f, "Multiply base and per-level movement speed while awakened."); AwakeningAttackMultiplier = config.Bind<float>("Awakening", "AttackSpeedMultiplier", 1.5f, "Multiply base and per-level attack speed while awakened. Authored cast lengths stay intact."); EnableFlight = config.Bind<bool>("Flight", "Enabled", true, "A second jump press in midair enters flight. Hold jump to rise, Ctrl to descend, release to hover. Another jump press exits. Landing and death clear flight."); FlightSpeedMultiplier = config.Bind<float>("Flight", "SpeedMultiplier", 1.25f, "Flight speed relative to current movement speed; clamped .25 through 4."); FlightDescendKey = config.Bind<KeyboardShortcut>("Controls", "FlightDescendKey", new KeyboardShortcut((KeyCode)306, Array.Empty<KeyCode>()), "Hold to descend during flight."); TargetingRange = config.Bind<float>("Targeting", "MaximumRangeMeters", 500f, "Crosshair ray range. The first enemy or solid surface selects the cast point; walls block the ray. Clamped to 10 through 1000 m."); AwakeningKey = config.Bind<KeyboardShortcut>("Controls", "AwakeningKey", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), "G: toggle the rainbow awakening aura and supplied Hopes and Dreams theme. Available after the current cast finishes."); GodstepKey = config.Bind<KeyboardShortcut>("Controls", "GodstepKey", new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()), "X: Godstep to the selected safe crosshair destination. Available independently of Shift / Chaos Sabers."); ConfigEntry<int> val2 = config.Bind<int>("Controls", "LayoutRevision", 0, "Automatic control layout migration. Revision 17 applies G awakening and X Godstep once; later custom bindings are retained."); if (val2.Value < 17) { AwakeningKey.Value = new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()); GodstepKey.Value = new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()); val2.Value = 17; flag = true; } EnableMoveHotkeys = config.Bind<bool>("Controls", "EnableAllMoveHotkeys", true, "1 Stars Blazing, 2 Shocker Breaker, 3 Chaos Sabers, 4 Chaos Blaster, 5 Godstep, 6 Hyper Goner. Keeps all six moves available with any loadout."); AwakeningMusicVolume = config.Bind<float>("Awakening", "MusicVolume", 0.55f, new ConfigDescription("Awakening music volume: 0 mutes, 1 is full volume. Independent of Audio/SoundEffectsVolume.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); StarRainSpread = config.Bind<float>("Stars Blazing", "SurroundingRainRadiusMeters", 60f, "Radius of the rainbow storm around Asriel at cast time; clamped to 1 through 100 m."); LightningRadius = config.Bind<float>("Shocker Breaker", "SurroundingRadiusMeters", 52f, "Cast-time area around Asriel. Default 52 m; capped at 90% of the configured Stars Blazing rain radius. Reference count is fixed at 28 small + 8 large strikes."); LightningDamagePercent = config.Bind<float>("Shocker Breaker", "ColumnDamagePercent", 650f, "Damage per narrow lightning strike, as percent of base damage."); LightningLargeDamagePercent = config.Bind<float>("Shocker Breaker", "LargeColumnDamagePercent", 1800f, "Damage per large lightning strike, as percent of base damage."); EnableReferenceAudio = config.Bind<bool>("Presentation", "EnableReferenceAudio", true, "Play continuous reference video audio for Stars Blazing, Chaos Blaster and Shocker Breaker. Background music in those recordings is retained."); ReferenceAudioVolume = config.Bind<float>("Presentation", "ReferenceAudioVolume", 0.7f, "Legacy sound-effects level, used as the initial default for Audio/SoundEffectsVolume. Change the new Audio setting after upgrading."); SoundEffectsVolume = config.Bind<float>("Audio", "SoundEffectsVolume", ReferenceAudioVolume.Value, new ConfigDescri