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 Pantheon v0.6.2
BepInEx/plugins/Redzergling-Pantheon/Pantheon.dll
Decompiled 10 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Xml; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using KinematicCharacterController; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using R2API; using Redzergling.Asterius; using Redzergling.Habeas; using Redzergling.Pantheon; using Redzergling.Silvax; using Redzergling.Sjorn; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ExpansionManagement; using RoR2.Networking; using RoR2.Projectile; using RoR2.Skills; using RoR2.SurvivorMannequins; using RoR2.UI; using RoR2.WwiseUtils; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.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 Redzergling.Sjorn { [RegisterAchievement("Redzergling.Sjorn.Skill01", "Redzergling.Sjorn.Skill01", null, 0u, typeof(SjornSkill01Server))] public sealed class SjornSkill01 : SjornSkillAchievement { } public sealed class SjornSkill01Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill02", "Redzergling.Sjorn.Skill02", null, 0u, typeof(SjornSkill02Server))] public sealed class SjornSkill02 : SjornSkillAchievement { } public sealed class SjornSkill02Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill04", "Redzergling.Sjorn.Skill04", null, 0u, typeof(SjornSkill04Server))] public sealed class SjornSkill04 : SjornSkillAchievement { } public sealed class SjornSkill04Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill05", "Redzergling.Sjorn.Skill05", null, 0u, typeof(SjornSkill05Server))] public sealed class SjornSkill05 : SjornSkillAchievement { } public sealed class SjornSkill05Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill07", "Redzergling.Sjorn.Skill07", null, 0u, typeof(SjornSkill07Server))] public sealed class SjornSkill07 : SjornSkillAchievement { } public sealed class SjornSkill07Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill08", "Redzergling.Sjorn.Skill08", null, 0u, typeof(SjornSkill08Server))] public sealed class SjornSkill08 : SjornSkillAchievement { } public sealed class SjornSkill08Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill10", "Redzergling.Sjorn.Skill10", null, 0u, typeof(SjornSkill10Server))] public sealed class SjornSkill10 : SjornSkillAchievement { } public sealed class SjornSkill10Server : SjornSkillServerAchievement { } [RegisterAchievement("Redzergling.Sjorn.Skill11", "Redzergling.Sjorn.Skill11", null, 0u, typeof(SjornSkill11Server))] public sealed class SjornSkill11 : SjornSkillAchievement { } public sealed class SjornSkill11Server : SjornSkillServerAchievement { } public static class SjornCombatEvents { public static event Action<CharacterBody, HealthComponent, int, float> Hit; public static event Action<CharacterBody, HealthComponent, int, float> Kill; public static event Action<CharacterBody, int> Cast; public static event Action<CharacterBody, int> BrewApplied; public static event Action<CharacterBody, float, int> Landing; internal static void OnHit(CharacterBody owner, HealthComponent victim, int id, float damage, bool killed) { SjornCombatEvents.Hit?.Invoke(owner, victim, id, damage); if (killed) { SjornCombatEvents.Kill?.Invoke(owner, victim, id, damage); } } internal static void OnCast(CharacterBody owner, int id) { SjornCombatEvents.Cast?.Invoke(owner, id); } internal static void OnBrewApplied(CharacterBody owner, int id) { SjornCombatEvents.BrewApplied?.Invoke(owner, id); } internal static void OnLanding(CharacterBody owner, float height, int hits) { SjornCombatEvents.Landing?.Invoke(owner, height, hits); } } internal static class Combat { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__Stats; } internal static BuffDef Brew; internal static BuffDef Stout; internal static BuffDef Frenzy; internal static BuffDef Guard; internal static BuffDef Reckless; internal static void Build() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown Brew = Buff("Hearthbrew", 3, new Color(1f, 0.63f, 0.2f)); Stout = Buff("GraniteStout", 4, new Color(0.65f, 0.8f, 0.9f)); Frenzy = Buff("BerserkerDraught", 5, new Color(0.9f, 0.2f, 0.12f)); Guard = Buff("IronboundRoll", 7, new Color(0.7f, 0.8f, 0.9f)); Reckless = Buff("AvalancheRoll", 8, new Color(0.9f, 0.3f, 0.15f)); object obj = <>O.<0>__Stats; if (obj == null) { StatHookEventHandler val = Stats; <>O.<0>__Stats = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; SjornEffects.Build(); } private static BuffDef Buff(string name, int icon, Color color) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) BuffDef obj = ScriptableObject.CreateInstance<BuffDef>(); ((Object)obj).name = "RedzerglingSjorn" + name; obj.buffColor = color; obj.canStack = false; obj.isDebuff = false; obj.iconSprite = SkillIcons.Load("skill-" + icon); ContentAddition.AddBuffDef(obj); return obj; } internal static void Dispose() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__Stats; if (obj == null) { StatHookEventHandler val = Stats; <>O.<0>__Stats = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj; } private static void Stats(CharacterBody body, StatHookEventArgs args) { if (body.HasBuff(Brew)) { args.moveSpeedMultAdd += 0.3f; args.damageMultAdd += 0.4f; args.armorAdd += 40f; } if (body.HasBuff(Stout)) { args.armorAdd += 100f; } if (body.HasBuff(Frenzy)) { args.attackSpeedMultAdd += 0.6f; args.moveSpeedMultAdd += 0.2f; args.armorAdd -= 20f; } if (body.HasBuff(Guard)) { args.armorAdd += 80f; } if (body.HasBuff(Reckless)) { args.armorAdd -= 30f; } } internal static void Drink(CharacterBody body, int id) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && body.healthComponent.alive && id >= 3 && id <= 5) { BuffDef[] array = (BuffDef[])(object)new BuffDef[3] { Brew, Stout, Frenzy }; foreach (BuffDef val in array) { body.ClearTimedBuffs(val); } body.AddTimedBuff((BuffDef)(id switch { 4 => Stout, 3 => Brew, _ => Frenzy, }), 4f); if (id == 4) { body.healthComponent.Heal(body.maxHealth * 0.12f, default(ProcChainMask), false); } SjornCombatEvents.OnBrewApplied(body, id); SjornEffects.Emit(2, body.corePosition, Vector3.up, 1.2f); } } internal static bool Enemy(CharacterBody owner, HealthComponent victim) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)victim) && victim.alive && Object.op_Implicit((Object)(object)victim.body) && Object.op_Implicit((Object)(object)victim.body.teamComponent) && (int)victim.body.teamComponent.teamIndex != 0) { return victim.body.teamComponent.teamIndex != owner.teamComponent.teamIndex; } return false; } internal static bool Hit(CharacterBody owner, HealthComponent victim, int id, float coefficient, float proc, Vector3 point, bool slow = false) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0066: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown if (!NetworkServer.active || !Enemy(owner, victim)) { return false; } float num = victim.combinedHealth + victim.barrier; bool alive = victim.alive; DamageInfo val = new DamageInfo { attacker = ((Component)owner).gameObject, inflictor = ((Component)owner).gameObject, damage = owner.damage * coefficient, crit = owner.RollCrit(), procCoefficient = proc, position = point, damageType = DamageTypeCombo.op_Implicit((DamageType)0), dotIndex = (DotIndex)(-1), damageColorIndex = (DamageColorIndex)0 }; victim.TakeDamage(val); float num2 = Mathf.Max(0f, num - victim.combinedHealth - victim.barrier); if (val.rejected || num2 <= 0f) { return false; } SjornCombatEvents.OnHit(owner, victim, id, num2, alive && !victim.alive); if (slow && victim.alive) { victim.body.AddTimedBuff(Buffs.Slow50, 1f); } GlobalEventManager.instance.OnHitEnemy(val, ((Component)victim).gameObject); GlobalEventManager.instance.OnHitAll(val, ((Component)victim).gameObject); return true; } internal static int Area(CharacterBody owner, Vector3 center, float radius, int id, float coefficient, float proc, HashSet<HealthComponent> previous = null, Vector3? direction = null, float cone = -1f, bool slow = false) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return 0; } int num = 0; HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>(); LayerIndex val = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)2); for (int i = 0; i < array.Length; i++) { HurtBox component = ((Component)array[i]).GetComponent<HurtBox>(); HealthComponent val2 = (Object.op_Implicit((Object)(object)component) ? component.healthComponent : null); if (!Enemy(owner, val2) || !hashSet.Add(val2) || (previous != null && previous.Contains(val2))) { continue; } Vector3 val3 = val2.body.corePosition - center; if (!direction.HasValue || !(Vector3.Dot(((Vector3)(ref val3)).normalized, direction.Value) < cone)) { Vector3 corePosition = val2.body.corePosition; val = LayerIndex.world; if (!Physics.Linecast(center, corePosition, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)1) && Hit(owner, val2, id, coefficient, proc, val2.body.corePosition, slow)) { num++; previous?.Add(val2); } } } return num; } internal static float LaunchSpeed(CharacterMotor motor, float height) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs((motor.useCustomGravity ? motor.CustomGravity : Physics.gravity.y) * motor.gravityMultiplier); return Mathf.Sqrt(2f * Mathf.Max(1f, num) * height); } } internal static class Content { internal static GameObject Body; internal static SurvivorDef Survivor; internal static readonly SkillDef[] Skills = (SkillDef[])(object)new SkillDef[12]; internal static readonly Type[] States = new Type[12] { typeof(IronCircle), typeof(GrudgeSplitter), typeof(TempestHew), typeof(Hearthbrew), typeof(GraniteStout), typeof(BerserkerDraught), typeof(CaskRoll), typeof(IronboundRoll), typeof(AvalancheRoll), typeof(Skybreaker), typeof(CometBound), typeof(Faultline) }; internal static readonly string[] Names = new string[12] { "Iron Circle", "Grudge Splitter", "Tempest Hew", "Hearthbrew", "Granite Stout", "Berserker Draught", "Cask Roll", "Ironbound Roll", "Avalanche Roll", "Skybreaker", "Comet Bound", "Faultline" }; internal static readonly float[] Cooldowns = new float[12] { 0f, 0f, 0f, 12f, 16f, 14f, 8f, 10f, 10f, 14f, 18f, 20f }; internal static readonly string[] Descriptions = new string[12] { "Sweep your axe in a full circle for <style=cIsDamage>360% damage</style> within <style=cIsUtility>4.5 m</style>. Hold to swing every <style=cIsUtility>0.9 seconds</style>, scaling with attack speed.", "Commit to a heavy overhead chop for <style=cIsDamage>650% damage</style> in a narrow frontal arc within <style=cIsUtility>5 m</style>. Hold to swing every <style=cIsUtility>1.3 seconds</style>, scaling with attack speed.", "Spin through three circular cuts for <style=cIsDamage>3 x 120% damage</style> within <style=cIsUtility>3.5 m</style>. Each cut has <style=cIsUtility>0.5 proc coefficient</style>. Hold for repeated <style=cIsUtility>1.1-second</style> combinations, scaling with attack speed.", "Drink for <style=cIsUtility>4 seconds</style> of <style=cIsDamage>+40% damage</style>, <style=cIsUtility>+30% movement speed and +40 armor</style>. Replaces other brews; refreshes without stacking.", "Drink to heal <style=cIsHealing>12% maximum health</style> and gain <style=cIsUtility>100 armor for 4 seconds</style>. Healing respects healing modifiers. Replaces other brews; refreshes without stacking.", "Drink for <style=cIsUtility>4 seconds</style> of <style=cIsDamage>+60% attack speed</style>, <style=cIsUtility>+20% movement speed</style> and <style=cDeath>-20 armor</style>. Replaces other brews; refreshes without stacking.", "Roll <style=cIsUtility>14 m</style> in your movement direction, dealing <style=cIsDamage>400% damage</style> once to each enemy crossed. Stops at terrain. Uses facing direction while stationary.", "Brace and roll <style=cIsUtility>10 m</style>, dealing <style=cIsDamage>250% damage</style> once per enemy and gaining <style=cIsUtility>80 armor during the roll</style>. Stops at terrain.", "Risk a fast <style=cIsUtility>18 m</style> roll for <style=cIsDamage>600% damage</style> once per enemy, with <style=cDeath>-30 armor during the roll</style>. Stops at terrain.", "Launch upward toward a <style=cIsUtility>10 m apex</style>, striking enemies within <style=cIsUtility>5 m</style> for <style=cIsDamage>300% damage</style>. Your landing triggers Stonefall if the actual fall exceeds 6 m. Ceilings can shorten the jump.", "Leap toward a <style=cIsUtility>12 m apex</style> with forward momentum, dealing <style=cIsDamage>250% damage</style> within <style=cIsUtility>4 m</style> at takeoff. Your landing triggers Stonefall after an actual fall over 6 m. Ceilings can shorten the leap.", "Plant your feet and fracture the ground within <style=cIsUtility>10 m</style> with <style=cIsDamage>six pulses of 180% damage over 3 seconds</style>. Each pulse slows enemies by <style=cIsUtility>50% for 1 second</style> and has <style=cIsUtility>0.3 proc coefficient</style>. Requires grounded activation; interruption ends remaining pulses. No launch." }; internal static T Load<T>(string address) where T : Object { //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) T val = Addressables.LoadAssetAsync<T>((object)address).WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Missing Sjorn asset " + address); } return val; } internal static void Build() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: 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_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) Type[] states = States; bool flag = default(bool); for (int i = 0; i < states.Length; i++) { ContentAddition.AddEntityState(states[i], ref flag); } Combat.Build(); SjornProgression.Build(); Body = PrefabAPI.InstantiateClone(Content.Load<GameObject>("RoR2/Base/Merc/MercBody.prefab"), "RedzerglingSjornBody", true); ExpansionRequirementComponent component = Body.GetComponent<ExpansionRequirementComponent>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } GenericSkill[] components = Body.GetComponents<GenericSkill>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } CharacterBody component2 = Body.GetComponent<CharacterBody>(); component2.baseNameToken = "REDZERGLING_SJORN_NAME"; component2.subtitleNameToken = "REDZERGLING_SJORN_SUBTITLE"; component2.bodyColor = new Color(0.85f, 0.48f, 0.16f); component2.baseMaxHealth = 120f; component2.levelMaxHealth = 36f; component2.baseArmor = 20f; component2.baseMoveSpeed = 7f; component2.baseDamage = 12f; component2.levelDamage = 2.4f; component2.baseJumpCount = 1; component2.dontCull = true; component2.skinIndex = 0u; component2.bodyFlags = (BodyFlags)(component2.bodyFlags | 1); component2.portraitIcon = (Texture)(object)SkillIcons.Load("portrait").texture; Body.AddComponent<SjornController>(); CapsuleCollider component3 = Body.GetComponent<CapsuleCollider>(); if (Object.op_Implicit((Object)(object)component3)) { component3.height = 2.5f; component3.center = Vector3.zero; component3.radius = 0.55f; } CharacterMotor component4 = Body.GetComponent<CharacterMotor>(); if (Object.op_Implicit((Object)(object)component4) && Object.op_Implicit((Object)(object)((BaseCharacterController)component4).Motor)) { ((BaseCharacterController)component4).Motor.SetCapsuleDimensions(0.55f, 2.5f, 0f); } EntityStateMachine[] components2 = Body.GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val in components2) { if (val.customName != "Body") { val.initialStateType = (val.mainStateType = new SerializableEntityStateType(typeof(Idle))); } } for (int j = 0; j < 12; j++) { SkillDef val2 = (SkillDef)(object)((j == 11) ? ScriptableObject.CreateInstance<GroundedSjornSkillDef>() : ((GroundedSjornSkillDef)(object)ScriptableObject.CreateInstance<SkillDef>())); ((Object)val2).name = (val2.skillName = "RedzerglingSjornSkill" + j); val2.skillNameToken = "REDZERGLING_SJORN_SKILL_" + j; val2.skillDescriptionToken = val2.skillNameToken + "_DESC"; LanguageAPI.Add(val2.skillNameToken, Names[j]); LanguageAPI.Add(val2.skillDescriptionToken, Descriptions[j]); val2.activationState = new SerializableEntityStateType(States[j]); val2.activationStateMachineName = ((j >= 6) ? "Body" : "Weapon"); val2.baseRechargeInterval = Cooldowns[j]; val2.baseMaxStock = (val2.rechargeStock = (val2.requiredStock = (val2.stockToConsume = 1))); val2.fullRestockOnAssign = (val2.resetCooldownTimerOnUse = true); val2.beginSkillCooldownOnSkillEnd = j >= 6; val2.mustKeyPress = j >= 3; val2.interruptPriority = (InterruptPriority)((j >= 3) ? ((j < 6) ? 1 : 2) : 0); val2.cancelSprintingOnActivation = true; val2.isCombatSkill = true; val2.icon = SkillIcons.Load("skill-" + j); ContentAddition.AddSkillDef(val2); Skills[j] = val2; } SkillLocator component5 = Body.GetComponent<SkillLocator>(); component5.primary = Family(0, "Primary"); component5.secondary = Family(1, "Secondary"); component5.utility = Family(2, "Utility"); component5.special = Family(3, "Special"); component5.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "REDZERGLING_SJORN_PASSIVE", skillDescriptionToken = "REDZERGLING_SJORN_PASSIVE_DESC", icon = SkillIcons.Load("passive") }; LanguageAPI.Add(component5.passiveSkill.skillNameToken, "Stonefall"); LanguageAPI.Add(component5.passiveSkill.skillDescriptionToken, "Take <style=cIsUtility>no fall damage</style>. After falling <style=cIsUtility>more than 6 m from your actual airborne apex</style>, land with a <style=cIsDamage>600% damage</style> shockwave within <style=cIsUtility>12 m</style> (0.5 proc coefficient). Once per landing. Teleports and spawning do not count."); SjornModel.Apply(((Component)Body.GetComponent<ModelLocator>().modelTransform).gameObject); ContentAddition.AddBody(Body); Survivor = ScriptableObject.CreateInstance<SurvivorDef>(); ((Object)Survivor).name = "RedzerglingSjorn"; Survivor.bodyPrefab = Body; Survivor.primaryColor = component2.bodyColor; Survivor.displayNameToken = component2.baseNameToken; Survivor.descriptionToken = "REDZERGLING_SJORN_DESCRIPTION"; Survivor.outroFlavorToken = "REDZERGLING_SJORN_OUTRO"; Survivor.mainEndingEscapeFailureFlavorToken = "REDZERGLING_SJORN_FAILURE"; Survivor.desiredSortPosition = 30f; Survivor.hidden = false; BuildDisplay(); ContentAddition.AddSurvivorDef(Survivor); LanguageAPI.Add(component2.baseNameToken, "Sjorn Halbrek"); LanguageAPI.Add(component2.subtitleNameToken, "The Unbroken Cask"); LanguageAPI.Add(Survivor.descriptionToken, "A dwarven barbarian whose axe clears a circle and whose landings shatter stone. Choose a brew for offense, defense or reckless speed; roll through enemies and launch above them to turn height into a shockwave.\n\nBy Redzergling."); LanguageAPI.Add(Survivor.outroFlavorToken, "...and so he left, with a thirst no world could quench."); LanguageAPI.Add(Survivor.mainEndingEscapeFailureFlavorToken, "...and so he vanished, a final thunder beneath the stone."); } private static GenericSkill Family(int slot, string name) { //IL_003b: 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_007c: Expected O, but got Unknown //IL_007c: 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) SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val).name = "RedzerglingSjorn" + name + "Family"; val.variants = (Variant[])(object)new Variant[3]; for (int i = 0; i < 3; i++) { int num = slot * 3 + i; Variant[] variants = val.variants; int num2 = i; Variant val2 = new Variant { skillDef = Skills[num], unlockableDef = ((i == 0) ? null : SjornProgression.GetUnlock(num)) }; ((Variant)(ref val2)).viewableNode = new Node(Skills[num].skillNameToken, false, (Node)null); variants[num2] = val2; } ContentAddition.AddSkillFamily(val); GenericSkill val3 = Body.AddComponent<GenericSkill>(); val3.skillName = name; typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(val3, val); return val3; } private static void BuildDisplay() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Survivor.displayPrefab = PrefabAPI.InstantiateClone(Content.Load<GameObject>("RoR2/Base/Merc/MercDisplay.prefab"), "RedzerglingSjornDisplay", false); Object.DestroyImmediate((Object)(object)((Component)Survivor.displayPrefab.GetComponentInChildren<CharacterModel>(true)).gameObject); GameObject val = PrefabAPI.InstantiateClone(((Component)Body.GetComponent<ModelLocator>().modelTransform).gameObject, "SjornSelectionModel", false); val.transform.SetParent(Survivor.displayPrefab.transform, false); val.transform.localPosition = new Vector3(-0.22f, 0f, 0f); val.transform.localRotation = Quaternion.Euler(0f, 22f, 0f); val.transform.localScale = Vector3.one * 0.9f; val.GetComponent<CharacterModel>().body = null; Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } Joint[] componentsInChildren2 = val.GetComponentsInChildren<Joint>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } Rigidbody[] componentsInChildren3 = val.GetComponentsInChildren<Rigidbody>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } SjornModel.SetDisplay(val); } } public sealed class Plugin : MonoBehaviour { public const string Guid = "com.Redzergling.Sjorn"; public const string Version = "0.1.0"; internal static ManualLogSource Log; internal void Initialize(ManualLogSource logger) { Log = logger; Content.Build(); SjornProgression.Install(); logger.LogInfo((object)"Sjorn Halbrek: twelve skills, native landing shockwave and source-preserving dwarf rig."); } private void OnDestroy() { SjornProgression.Dispose(); Combat.Dispose(); } } public interface ISjornPose { int ActionKind { get; } float Progress { get; } float ContactFraction { get; } int Variant { get; } } internal sealed class SjornRunProgress { internal sealed class BossCredit { internal TeleporterInteraction Teleporter; internal CharacterBody Body; } internal uint PrimaryHits; internal uint PrimaryKills; internal uint SecondaryCasts; internal uint BrewKills; internal uint UtilityCasts; internal uint AirKills; internal uint SpecialKills; internal uint Completed; internal readonly Dictionary<HealthComponent, BossCredit> Bosses = new Dictionary<HealthComponent, BossCredit>(); internal CharacterBody PendingBody; internal TeleporterInteraction PendingTeleporter; internal void Evaluate() { if (PrimaryHits >= 100) { Completed |= 1u; } if (PrimaryKills >= 20) { Completed |= 2u; } if (SecondaryCasts >= 30) { Completed |= 4u; } if (BrewKills >= 20) { Completed |= 8u; } if (UtilityCasts >= 20) { Completed |= 16u; } if (AirKills >= 10) { Completed |= 32u; } if (SpecialKills >= 20) { Completed |= 64u; } } } internal static class SjornProgression { internal sealed class Rule { internal int Skill; internal int Bit; internal string Identity; internal string Description; internal UnlockableDef Unlock; } internal static readonly List<Rule> Rules = new List<Rule>(); private static readonly Dictionary<CharacterMaster, SjornRunProgress> records = new Dictionary<CharacterMaster, SjornRunProgress>(); private static Run run; private static float nextPoll; internal static bool SuppressGrants => Redzergling.Pantheon.Validation.Requested; internal static event Action<CharacterMaster> Changed; internal static void Build() { if (Rules.Count > 0) { return; } string[] array = new string[8] { "land 100 direct primary hits in one run", "defeat 20 enemies directly with primary attacks in one run", "drink 30 brews in one run", "defeat 20 enemies while a brew is active in one run", "use roll skills 20 times in one run", "defeat 10 enemies directly while airborne in one run", "defeat 20 enemies directly with special skills in one run", "damage a teleporter boss before its death, then remain alive until that teleporter finishes charging" }; int num = 0; int[] array2 = new int[8] { 1, 2, 4, 5, 7, 8, 10, 11 }; for (int i = 0; i < array2.Length; i++) { int num2 = array2[i]; string text = "Redzergling.Sjorn.Skill" + num2.ToString("D2"); string title = "Sjorn: " + Content.Names[num2]; string description = "As Sjorn Halbrek, " + array[num] + "."; UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = text; val.nameToken = "ACHIEVEMENT_" + text.ToUpperInvariant() + "_NAME"; val.achievementIcon = SkillIcons.Load("skill-" + num2); val.getHowToUnlockString = () => description; val.getUnlockedString = () => title; ContentAddition.AddUnlockableDef(val); LanguageAPI.Add(val.nameToken, title); LanguageAPI.Add("ACHIEVEMENT_" + text.ToUpperInvariant() + "_DESCRIPTION", description); Rules.Add(new Rule { Skill = num2, Bit = num++, Identity = text, Description = description, Unlock = val }); } } internal static UnlockableDef GetUnlock(int id) { if (!Redzergling.Pantheon.Plugin.RequireAchievements.Value) { return null; } return Rules.First((Rule r) => r.Skill == id).Unlock; } internal static SjornRunProgress Record(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master)) { return null; } if ((Object)(object)run != (Object)(object)Run.instance) { records.Clear(); run = Run.instance; } if (!records.TryGetValue(master, out var value)) { records.Add(master, value = new SjornRunProgress()); } return value; } internal static bool Complete(CharacterMaster master, string identity) { Rule rule = Rules.FirstOrDefault((Rule r) => r.Identity == identity); if (rule != null && Object.op_Implicit((Object)(object)master) && (Object)(object)run == (Object)(object)Run.instance && records.TryGetValue(master, out var value)) { return (value.Completed & (uint)(1 << rule.Bit)) != 0; } return false; } private static SjornRunProgress Owner(CharacterBody body) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || !Object.op_Implicit((Object)(object)((Component)body).GetComponent<SjornController>())) { return null; } return Record(body.master); } private static void Notify(CharacterBody body, SjornRunProgress record) { record.Evaluate(); if (!SuppressGrants) { SjornProgression.Changed?.Invoke(body.master); } } private static void Hit(CharacterBody body, HealthComponent target, int skill, float damage) { SjornRunProgress sjornRunProgress = Owner(body); if (sjornRunProgress != null && Object.op_Implicit((Object)(object)target) && !(damage <= 0f) && skill >= 0 && skill < 3) { sjornRunProgress.PrimaryHits++; Notify(body, sjornRunProgress); } } private static void Kill(CharacterBody body, HealthComponent target, int skill, float damage) { SjornRunProgress sjornRunProgress = Owner(body); if (sjornRunProgress != null && Object.op_Implicit((Object)(object)target) && !(damage <= 0f)) { switch (skill) { default: return; case 0: case 1: case 2: sjornRunProgress.PrimaryKills++; break; case -1: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: break; } if (skill >= 9) { sjornRunProgress.SpecialKills++; } if (((Component)body).GetComponent<SjornController>().BrewActive) { sjornRunProgress.BrewKills++; } if (skill >= 0 && Object.op_Implicit((Object)(object)body.characterMotor) && !body.characterMotor.isGrounded) { sjornRunProgress.AirKills++; } Notify(body, sjornRunProgress); } } private static void Cast(CharacterBody body, int skill) { SjornRunProgress sjornRunProgress = Owner(body); if (sjornRunProgress != null) { switch (skill) { default: return; case 6: case 7: case 8: sjornRunProgress.UtilityCasts++; break; case 0: case 1: case 2: case 3: case 4: case 5: case 9: case 10: case 11: break; } Notify(body, sjornRunProgress); } } private static void BrewApplied(CharacterBody body, int skill) { SjornRunProgress sjornRunProgress = Owner(body); if (sjornRunProgress != null && skill >= 3 && skill <= 5 && body.healthComponent.alive && body.HasBuff((BuffDef)(skill switch { 4 => Combat.Stout, 3 => Combat.Brew, _ => Combat.Frenzy, }))) { sjornRunProgress.SecondaryCasts++; Notify(body, sjornRunProgress); } } private static void Damage(DamageReport report) { if (report == null || report.isFriendlyFire || report.damageDealt <= 0f || !Object.op_Implicit((Object)(object)report.victimBody) || !Object.op_Implicit((Object)(object)report.victimMaster)) { return; } SjornRunProgress sjornRunProgress = Owner(report.attackerBody); if (sjornRunProgress != null) { TeleporterInteraction instance = TeleporterInteraction.instance; if (Object.op_Implicit((Object)(object)instance) && !instance.isIdle && Object.op_Implicit((Object)(object)instance.bossGroup) && Object.op_Implicit((Object)(object)instance.bossGroup.combatSquad) && instance.bossGroup.combatSquad.ContainsMember(report.victimMaster)) { sjornRunProgress.Bosses[report.victimBody.healthComponent] = new SjornRunProgress.BossCredit { Teleporter = instance, Body = report.attackerBody }; } } } private static void Death(DamageReport report) { if (!NetworkServer.active || report == null || !Object.op_Implicit((Object)(object)report.victimBody)) { return; } KeyValuePair<CharacterMaster, SjornRunProgress>[] array = records.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<CharacterMaster, SjornRunProgress> keyValuePair = array[i]; if (!Object.op_Implicit((Object)(object)keyValuePair.Key)) { records.Remove(keyValuePair.Key); continue; } SjornRunProgress value = keyValuePair.Value; CharacterBody body = keyValuePair.Key.GetBody(); if (value.Bosses.TryGetValue(report.victimBody.healthComponent, out var value2)) { value.Bosses.Remove(report.victimBody.healthComponent); if (Object.op_Implicit((Object)(object)value2.Teleporter) && (Object)(object)value2.Teleporter == (Object)(object)TeleporterInteraction.instance && Object.op_Implicit((Object)(object)body) && (Object)(object)body == (Object)(object)value2.Body && body.healthComponent.alive && Object.op_Implicit((Object)(object)((Component)body).GetComponent<SjornController>())) { value.PendingBody = body; value.PendingTeleporter = value2.Teleporter; } } if ((Object)(object)body == (Object)(object)report.victimBody || (Object)(object)value.PendingBody == (Object)(object)report.victimBody) { value.PendingBody = null; value.PendingTeleporter = null; value.Bosses.Clear(); } } } private static void Charged(TeleporterInteraction t) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)t) || !t.isCharged || (Object.op_Implicit((Object)(object)t.bossGroup) && Object.op_Implicit((Object)(object)t.bossGroup.combatSquad) && t.bossGroup.combatSquad.memberCount > 0)) { return; } KeyValuePair<CharacterMaster, SjornRunProgress>[] array = records.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<CharacterMaster, SjornRunProgress> keyValuePair = array[i]; if (Object.op_Implicit((Object)(object)keyValuePair.Key)) { SjornRunProgress value = keyValuePair.Value; CharacterBody body = keyValuePair.Key.GetBody(); if (CompleteTeleporter(value, t, body, charged: true, Object.op_Implicit((Object)(object)body) && body.healthComponent.alive)) { Notify(body, value); } } } } private static bool CompleteTeleporter(SjornRunProgress r, TeleporterInteraction t, CharacterBody b, bool charged, bool alive) { if (!charged || !alive || !Object.op_Implicit((Object)(object)t) || !Object.op_Implicit((Object)(object)b) || (Object)(object)b != (Object)(object)r.PendingBody || (Object)(object)r.PendingTeleporter != (Object)(object)t || !Object.op_Implicit((Object)(object)((Component)b).GetComponent<SjornController>())) { return false; } r.Completed |= 128u; r.PendingBody = null; r.PendingTeleporter = null; return true; } private static void Reset(Run value) { records.Clear(); run = Run.instance; } private static void Poll() { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || Time.unscaledTime < nextPoll) { return; } nextPoll = Time.unscaledTime + 0.25f; KeyValuePair<CharacterMaster, SjornRunProgress>[] array = records.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<CharacterMaster, SjornRunProgress> keyValuePair = array[i]; if (Object.op_Implicit((Object)(object)keyValuePair.Key)) { SjornRunProgress value = keyValuePair.Value; CharacterBody body = keyValuePair.Key.GetBody(); if (Object.op_Implicit((Object)(object)value.PendingBody) && (!Object.op_Implicit((Object)(object)body) || (Object)(object)body != (Object)(object)value.PendingBody || !body.healthComponent.alive)) { value.PendingBody = null; value.PendingTeleporter = null; } } } Charged(TeleporterInteraction.instance); } internal static void Install() { SjornCombatEvents.Hit += Hit; SjornCombatEvents.Kill += Kill; SjornCombatEvents.Cast += Cast; SjornCombatEvents.BrewApplied += BrewApplied; GlobalEventManager.onServerDamageDealt += Damage; GlobalEventManager.onCharacterDeathServer += Death; TeleporterInteraction.onTeleporterChargedGlobal += Charged; Run.onRunStartGlobal += Reset; Run.onRunDestroyGlobal += Reset; RoR2Application.onUpdate += Poll; } internal static void Dispose() { SjornCombatEvents.Hit -= Hit; SjornCombatEvents.Kill -= Kill; SjornCombatEvents.Cast -= Cast; SjornCombatEvents.BrewApplied -= BrewApplied; GlobalEventManager.onServerDamageDealt -= Damage; GlobalEventManager.onCharacterDeathServer -= Death; TeleporterInteraction.onTeleporterChargedGlobal -= Charged; Run.onRunStartGlobal -= Reset; Run.onRunDestroyGlobal -= Reset; RoR2Application.onUpdate -= Poll; records.Clear(); } internal static IEnumerator ValidateNative(CharacterBody owner, CharacterBody enemy, Action<bool, string> check) { SjornRunProgress saved = Record(owner.master); Vector3 position = owner.footPosition; SjornRunProgress fixture = new SjornRunProgress { PrimaryHits = 99u, PrimaryKills = 19u, SecondaryCasts = 29u, BrewKills = 19u, UtilityCasts = 19u, AirKills = 9u, SpecialKills = 19u }; fixture.Evaluate(); check(fixture.Completed == 0, "Sjorn progression: incomplete thresholds reject grants"); try { records[owner.master] = fixture; SjornCombatEvents.OnHit(owner, enemy.healthComponent, 0, 1f, killed: false); check((fixture.Completed & 1) != 0, "Sjorn progression: native hit event completes100primaryhits"); SjornCombatEvents.OnHit(owner, enemy.healthComponent, 1, 1f, killed: true); check((fixture.Completed & 2) != 0, "Sjorn progression: native primary kill event completes20kills"); SjornCombatEvents.OnCast(owner, 3); check(fixture.SecondaryCasts == 29 && (fixture.Completed & 4) == 0, "Sjorn progression: starting/interrupted drink animation cannot farm completed brews"); owner.AddBuff(Combat.Brew); try { SjornCombatEvents.OnBrewApplied(owner, 3); SjornCombatEvents.OnHit(owner, enemy.healthComponent, 0, 1f, killed: true); } finally { owner.RemoveBuff(Combat.Brew); } check((fixture.Completed & 4) != 0, "Sjorn progression: successfully applied brew event completes30drinks"); check((fixture.Completed & 8) != 0, "Sjorn progression: native brew status plus kill event completes20brewkills"); SjornCombatEvents.OnCast(owner, 6); check((fixture.Completed & 0x10) != 0, "Sjorn progression: utility cast event completes20rolls"); ((BaseCharacterController)owner.characterMotor).Motor.ForceUnground(0.1f); owner.characterMotor.velocity = Vector3.up * 4f; yield return (object)new WaitForFixedUpdate(); yield return (object)new WaitForFixedUpdate(); SjornCombatEvents.OnHit(owner, enemy.healthComponent, 0, 1f, killed: true); check(!owner.characterMotor.isGrounded && (fixture.Completed & 0x20) != 0, "Sjorn progression: actual airborne motor plus kill event completes10airkills"); SjornCombatEvents.OnHit(owner, enemy.healthComponent, 9, 1f, killed: true); check((fixture.Completed & 0x40) != 0 && fixture.Completed == 127, "Sjorn progression: special event completes20specialkills; all7countmilestones live"); TeleporterInteraction instance = TeleporterInteraction.instance; if (Object.op_Implicit((Object)(object)instance)) { fixture.Completed = 0u; fixture.Bosses[enemy.healthComponent] = new SjornRunProgress.BossCredit { Body = owner, Teleporter = instance }; Death(new DamageReport(new DamageInfo { attacker = ((Component)owner).gameObject, damage = 1f }, enemy.healthComponent, 1f, 1f)); check((Object)(object)fixture.PendingBody == (Object)(object)owner && (Object)(object)fixture.PendingTeleporter == (Object)(object)instance && fixture.Completed == 0, "Sjorn progression: contributed boss death qualifies without premature unlock"); check(!CompleteTeleporter(fixture, instance, owner, charged: false, alive: true) && !CompleteTeleporter(fixture, instance, owner, charged: true, alive: false) && !CompleteTeleporter(fixture, instance, enemy, charged: true, alive: true), "Sjorn progression: unfinished/dead/wrong-owner teleporter fixtures reject reward"); check(CompleteTeleporter(fixture, instance, owner, charged: true, alive: true) && fixture.Completed == 128, "Sjorn progression: same-owner completed living teleporter awards eighth milestone"); fixture.PendingBody = owner; fixture.PendingTeleporter = instance; Death(new DamageReport(new DamageInfo { attacker = ((Component)enemy).gameObject, damage = 1f }, owner.healthComponent, 1f, 1f)); check(!Object.op_Implicit((Object)(object)fixture.PendingBody) && !Object.op_Implicit((Object)(object)fixture.PendingTeleporter), "Sjorn progression: death clears pending boss qualification"); fixture.Bosses[enemy.healthComponent] = new SjornRunProgress.BossCredit { Body = enemy, Teleporter = instance }; Death(new DamageReport(new DamageInfo { attacker = ((Component)owner).gameObject, damage = 1f }, enemy.healthComponent, 1f, 1f)); check(!Object.op_Implicit((Object)(object)fixture.PendingBody), "Sjorn progression: replaced contributing body cannot inherit qualification"); } else { check(arg1: false, "Sjorn progression: real stage teleporter available for boss fixtures"); } bool flag = true; foreach (Rule rule in Rules) { fixture.Completed = (uint)(1 << rule.Bit); flag &= Complete(owner.master, rule.Identity) && Rules.Where((Rule r) => r != rule).All((Rule r) => !Complete(owner.master, r.Identity)); } check(flag, "Sjorn progression: all8 native unlock identities isolated"); fixture.Completed = 0u; uint primaryHits = fixture.PrimaryHits; Hit(owner, enemy.healthComponent, -1, 1f); Hit(owner, enemy.healthComponent, 0, 0f); check(fixture.PrimaryHits == primaryHits, "Sjorn progression: passive/zero damage cannot count as primary hits"); check(SuppressGrants, "Sjorn progression: validation grants suppressed"); } finally { records[owner.master] = saved; TeleportHelper.TeleportBody(owner, position); owner.characterMotor.velocity = Vector3.zero; } } } public abstract class SjornSkillAchievement : BaseAchievement { public override void OnInstall() { ((BaseAchievement)this).OnInstall(); if (!SjornProgression.SuppressGrants) { ((BaseAchievement)this).SetServerTracked(true); } } public override void OnUninstall() { ((BaseAchievement)this).SetServerTracked(false); ((BaseAchievement)this).OnUninstall(); } } public abstract class SjornSkillServerAchievement : BaseServerAchievement { private bool granted; private float next; public override void OnInstall() { ((BaseServerAchievement)this).OnInstall(); RoR2Application.onUpdate += Check; SjornProgression.Changed += Changed; } public override void OnUninstall() { RoR2Application.onUpdate -= Check; SjornProgression.Changed -= Changed; ((BaseServerAchievement)this).OnUninstall(); } private void Changed(CharacterMaster master) { if (Object.op_Implicit((Object)(object)((BaseServerAchievement)this).networkUser) && (Object)(object)((BaseServerAchievement)this).networkUser.master == (Object)(object)master) { next = 0f; Check(); } } private void Check() { if (!granted && !SjornProgression.SuppressGrants && NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)((BaseServerAchievement)this).networkUser) && !(Time.unscaledTime < next)) { next = Time.unscaledTime + 0.2f; if (SjornProgression.Complete(((BaseServerAchievement)this).networkUser.master, base.achievementDef.identifier)) { granted = true; ((BaseServerAchievement)this).Grant(); } } } } internal sealed class SjornFallTracker { internal bool Armed; internal bool Airborne; internal float Apex; internal float AirTime; internal void Reset() { Armed = false; Airborne = false; Apex = (AirTime = 0f); } internal float Observe(float height, bool grounded, bool alive, float delta) { if (!alive) { Reset(); return 0f; } if (grounded) { float num = ((Armed && Airborne && AirTime >= 0.1f) ? (Apex - height) : 0f); Armed = true; Airborne = false; AirTime = 0f; Apex = height; if (!(num > 6f)) { return 0f; } return num; } if (!Armed) { return 0f; } if (!Airborne) { Airborne = true; Apex = Mathf.Max(Apex, height); AirTime = 0f; } Apex = Mathf.Max(Apex, height); AirTime += delta; return 0f; } } public sealed class SjornController : MonoBehaviour, ITeleportHandler, IEventSystemHandler { internal readonly SjornFallTracker Fall = new SjornFallTracker(); private CharacterBody body; private Vector3 lastPosition; private bool sampled; private GameObject aura; public int Landings { get; private set; } public float LastFall { get; private set; } public int LastLandingHits { get; private set; } public bool BrewActive { get { if (Object.op_Implicit((Object)(object)body)) { if (!body.HasBuff(Combat.Brew) && !body.HasBuff(Combat.Stout)) { return body.HasBuff(Combat.Frenzy); } return true; } return false; } } private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } public void OnTeleport(Vector3 oldPosition, Vector3 newPosition) { ResetFall(); } public void ResetFall() { Fall.Reset(); sampled = false; } private void OnEnable() { ResetFall(); } private void OnDisable() { ResetFall(); if (Object.op_Implicit((Object)(object)aura)) { Object.Destroy((Object)(object)aura); } } private void FixedUpdate() { //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_00ba: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.characterMotor)) { bool alive = Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive; Vector3 footPosition = body.footPosition; float num = Mathf.Max(8f, (((Vector3)(ref body.characterMotor.velocity)).magnitude + body.moveSpeed + 20f) * Time.fixedDeltaTime * 3f); if (sampled && Vector3.Distance(lastPosition, footPosition) > num) { Fall.Reset(); } lastPosition = footPosition; sampled = true; float num2 = Fall.Observe(footPosition.y, body.characterMotor.isGrounded, alive, Time.fixedDeltaTime); if (num2 > 0f) { LastFall = num2; Landings++; LastLandingHits = Combat.Area(body, footPosition + Vector3.up * 0.5f, 12f, -1, 6f, 0.5f); SjornEffects.Emit(3, footPosition + Vector3.up * 0.12f, Vector3.up, 12f); SjornCombatEvents.OnLanding(body, num2, LastLandingHits); } } } private void LateUpdate() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) int num; if (BrewActive && Object.op_Implicit((Object)(object)body.healthComponent)) { num = (body.healthComponent.alive ? 1 : 0); if (num != 0 && !Object.op_Implicit((Object)(object)aura)) { aura = new GameObject("SjornBrewAura"); aura.AddComponent<SjornBrewVisual>(); } } else { num = 0; } if (num != 0) { aura.transform.position = body.footPosition + Vector3.up * 0.1f; aura.GetComponent<SjornBrewVisual>().Tint = (body.HasBuff(Combat.Stout) ? new Color(0.6f, 0.8f, 1f) : (body.HasBuff(Combat.Frenzy) ? new Color(1f, 0.2f, 0.1f) : new Color(1f, 0.65f, 0.2f))); } else if (Object.op_Implicit((Object)(object)aura)) { Object.Destroy((Object)(object)aura); aura = null; } } } internal static class SjornEffects { internal static readonly GameObject[] Prefabs = (GameObject[])(object)new GameObject[6]; internal static Material Gold; internal static Material Stone; internal static Material Red; internal static Material Rock; internal static void Build() { //IL_000f: 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_004b: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown Gold = Material(new Color(1f, 0.68f, 0.25f)); Stone = Material(new Color(0.7f, 0.8f, 0.9f)); Red = Material(new Color(1f, 0.32f, 0.1f)); Rock = Material(new Color(0.42f, 0.36f, 0.28f)); Rock.SetFloat("_EmPower", 0.08f); for (int i = 0; i < 6; i++) { GameObject val = new GameObject("SjornEffect" + i); val.AddComponent<EffectComponent>().applyScale = false; val.AddComponent<VFXAttributes>().DoNotPool = true; val.AddComponent<DestroyOnTimer>().duration = ((i == 2) ? 0.7f : 0.45f); val.AddComponent<SjornImpactVisual>().Kind = i; Prefabs[i] = PrefabAPI.InstantiateClone(val, "SjornEffectPrefab" + i, false); Object.DestroyImmediate((Object)(object)val); ContentAddition.AddEffect(Prefabs[i]); } } internal static Material Material(Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown Material val = new Material(Content.Load<Shader>("RoR2/Base/Shaders/HGStandard.shader")); val.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); val.SetColor("_Color", color); val.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture); val.SetColor("_EmColor", color); val.SetFloat("_EmPower", 0.65f); val.SetFloat("_NormalStrength", 0f); val.SetFloat("_Smoothness", 0.3f); val.SetFloat("_Cull", 0f); return val; } internal static void Emit(int kind, Vector3 point, Vector3 direction, float radius) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (NetworkServer.active) { EffectManager.SpawnEffect(Prefabs[kind], new EffectData { origin = point, rotation = Util.QuaternionSafeLookRotation(direction), scale = radius }, true); } } internal static LineRenderer Line(Transform parent, string name, Material material, int count, float width) { //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_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.layer = ((Component)parent).gameObject.layer; LineRenderer obj = val.AddComponent<LineRenderer>(); obj.useWorldSpace = false; obj.positionCount = count; ((Renderer)obj).sharedMaterial = material; float startWidth = (obj.endWidth = width); obj.startWidth = startWidth; obj.numCornerVertices = 2; obj.numCapVertices = 2; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return obj; } } public sealed class SjornImpactVisual : MonoBehaviour { internal static readonly HashSet<SjornImpactVisual> Active = new HashSet<SjornImpactVisual>(); public int Kind; private void OnEnable() { Active.Add(this); } private void OnDisable() { Active.Remove(this); } private void Start() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) EffectComponent component = ((Component)this).GetComponent<EffectComponent>(); float radius = ((Object.op_Implicit((Object)(object)component) && component.effectData != null) ? Mathf.Max(0.1f, component.effectData.scale) : 1f); if (Kind >= 2) { ((Component)this).transform.rotation = Quaternion.identity; } string family = ((Kind == 0) ? "axe-circle" : ((Kind == 1) ? "heavy-sword" : ((Kind == 2) ? "drink" : ((Kind == 3 || Kind == 4) ? "quake" : "roll")))); LegacyNativeVisual legacyNativeVisual = LegacyNativeVisual.Add(((Component)this).transform, family, radius, new Color(1f, 0.86f, 0.63f)); if (Kind == 4) { legacyNativeVisual.SlamIntensity = 0.18f; } if (Kind == 3) { FeedbackAudio.Play(((Component)this).gameObject, "Play_loader_R_variant_slam", 0.3f, "landing"); } } } internal sealed class SjornBrewVisual : MonoBehaviour { internal Color Tint; private LegacyNativeVisual native; private void Start() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) native = LegacyNativeVisual.Add(((Component)this).transform, "brew", 1f, Tint); } private void Update() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)native)) { native.Tint = Tint; } } } internal static class SjornModel { private sealed class Joint { internal string Name; internal Vector3 Head; internal Vector3 Tail; internal int Parent; } private sealed class Source { internal Joint[] Joints; internal Vector3[] Vertices; internal Vector3[] Normals; internal Vector2[] UV; internal BoneWeight[] Weights; internal int[] Triangles; } internal const string Prefix = "SjornAuthored"; private static Source cached; private static Material material; private static Vector3 ReadVector(BinaryReader r) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle()); } private static Source Read() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) if (cached != null) { return cached; } using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Redzergling.Sjorn.Mesh"); using GZipStream input = new GZipStream(stream, CompressionMode.Decompress); using BinaryReader binaryReader = new BinaryReader(input); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(4)) != "HA01" || binaryReader.ReadInt32() != 1) { throw new InvalidDataException("Sjorn mesh format"); } Source source = new Source { Joints = new Joint[binaryReader.ReadInt32()] }; for (int i = 0; i < source.Joints.Length; i++) { source.Joints[i] = new Joint { Name = Encoding.UTF8.GetString(binaryReader.ReadBytes(binaryReader.ReadInt32())), Head = ReadVector(binaryReader), Tail = ReadVector(binaryReader), Parent = binaryReader.ReadInt32() }; } int num = binaryReader.ReadInt32(); source.Vertices = (Vector3[])(object)new Vector3[num]; source.Normals = (Vector3[])(object)new Vector3[num]; source.UV = (Vector2[])(object)new Vector2[num]; source.Weights = (BoneWeight[])(object)new BoneWeight[num]; for (int j = 0; j < num; j++) { source.Vertices[j] = ReadVector(binaryReader); source.Normals[j] = ReadVector(binaryReader); source.UV[j] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); BoneWeight[] weights = source.Weights; int num2 = j; BoneWeight val = default(BoneWeight); ((BoneWeight)(ref val)).boneIndex0 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex1 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex2 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).boneIndex3 = binaryReader.ReadInt32(); ((BoneWeight)(ref val)).weight0 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight1 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight2 = binaryReader.ReadSingle(); ((BoneWeight)(ref val)).weight3 = binaryReader.ReadSingle(); weights[num2] = val; } source.Triangles = new int[binaryReader.ReadInt32()]; for (int k = 0; k < source.Triangles.Length; k++) { source.Triangles[k] = binaryReader.ReadInt32(); } return cached = source; } private static Texture2D Texture(string name) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Redzergling.Sjorn." + name); using MemoryStream memoryStream = new MemoryStream(); if (stream == null) { throw new InvalidDataException("Sjorn texture missing " + name); } stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!ImageConversion.LoadImage(val, memoryStream.ToArray())) { throw new InvalidDataException(name); } ((Object)val).name = "SjornAuthored" + name; ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).anisoLevel = 4; return val; } private static Material Material() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0054: 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) if (Object.op_Implicit((Object)(object)material)) { return material; } material = new Material(Content.Load<Shader>("RoR2/Base/Shaders/HGStandard.shader")) { name = "SjornSuppliedMaterial" }; material.SetTexture("_MainTex", (Texture)(object)Texture("diffuse")); material.SetColor("_Color", Color.white); material.SetTexture("_EmTex", (Texture)(object)Texture("emissive")); material.SetColor("_EmColor", Color.white); material.SetFloat("_EmPower", 0.45f); material.SetFloat("_Smoothness", 0.24f); material.SetFloat("_SpecularStrength", 0.18f); material.SetFloat("_NormalStrength", 0f); material.SetFloat("_Cull", 2f); material.SetFloat("_DitherOn", 1f); material.EnableKeyword("DITHER"); return material; } internal static void Apply(GameObject modelObject) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0745: Unknown result type (might be due to invalid IL or missing references) Source source = Read(); Transform root = modelObject.transform; CharacterModel component = modelObject.GetComponent<CharacterModel>(); Transform parent = root.parent; if (!Object.op_Implicit((Object)(object)parent) || Object.op_Implicit((Object)(object)((Component)parent).GetComponent<CharacterBody>())) { throw new InvalidOperationException("Sjorn requires a separate native presentation origin"); } parent.localPosition = new Vector3(parent.localPosition.x, -0.923f, parent.localPosition.z); RagdollController[] componentsInChildren = ((Component)root).GetComponentsInChildren<RagdollController>(true); foreach (RagdollController val in componentsInChildren) { Transform[] bones = val.bones; foreach (Transform obj in bones) { Collider component2 = ((Component)obj).GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = false; } Rigidbody component3 = ((Component)obj).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component3)) { component3.isKinematic = true; } } Object.DestroyImmediate((Object)(object)val); } Renderer[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren2; foreach (Renderer val2 in array) { val2.forceRenderingOff = true; val2.enabled = false; if (val2 is SkinnedMeshRenderer) { ((SkinnedMeshRenderer)val2).sharedMesh = null; } if (((Component)val2).transform.childCount == 0) { ((Component)val2).gameObject.SetActive(false); } } Transform[] componentsInChildren3 = ((Component)root).GetComponentsInChildren<Transform>(true); Transform[] array2 = (Transform[])(object)new Transform[source.Joints.Length]; Transform[] bones2 = (Transform[])(object)new Transform[source.Joints.Length]; Quaternion[] array3 = (Quaternion[])(object)new Quaternion[source.Joints.Length]; Vector3[] array4 = (Vector3[])(object)new Vector3[source.Joints.Length]; for (int k = 0; k < bones2.Length; k++) { Joint j2 = source.Joints[k]; array2[k] = ((IEnumerable<Transform>)componentsInChildren3).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == j2.Name)); array3[k] = (Object.op_Implicit((Object)(object)array2[k]) ? (Quaternion.Inverse(root.rotation) * array2[k].rotation) : Quaternion.identity); Transform transform = new GameObject("SjornAuthored" + j2.Name).transform; transform.SetParent((j2.Parent < 0) ? root : bones2[j2.Parent], false); transform.position = root.TransformPoint(j2.Head); transform.rotation = root.rotation; bones2[k] = transform; array4[k] = transform.localPosition; } Mesh val3 = new Mesh { name = "SjornExactSourceMesh", indexFormat = (IndexFormat)1, vertices = source.Vertices, normals = source.Normals, uv = source.UV, boneWeights = source.Weights, bindposes = bones2.Select((Transform t) => t.worldToLocalMatrix * root.localToWorldMatrix).ToArray(), triangles = source.Triangles }; val3.RecalculateBounds(); val3.RecalculateTangents(); int num = Array.FindIndex(source.Joints, (Joint joint) => joint.Name == "axe"); int num2 = Array.FindIndex(source.Joints, (Joint joint) => joint.Name == "bottle"); List<int> list = new List<int>(); List<int> list2 = new List<int>(); List<int> list3 = new List<int>(); for (int num3 = 0; num3 < source.Triangles.Length; num3 += 3) { ((((BoneWeight)(ref source.Weights[source.Triangles[num3]])).boneIndex0 == num) ? list2 : ((((BoneWeight)(ref source.Weights[source.Triangles[num3]])).boneIndex0 == num2) ? list3 : list)).AddRange(new int[3] { source.Triangles[num3], source.Triangles[num3 + 1], source.Triangles[num3 + 2] }); } Mesh val4 = Object.Instantiate<Mesh>(val3); ((Object)val4).name = "SjornBodyMesh"; val4.triangles = list.ToArray(); Mesh val5 = Object.Instantiate<Mesh>(val3); ((Object)val5).name = "SjornAxeMesh"; val5.triangles = list2.ToArray(); Mesh val6 = Object.Instantiate<Mesh>(val3); ((Object)val6).name = "SjornBottleMesh"; val6.triangles = list3.ToArray(); Func<string, Mesh, SkinnedMeshRenderer> func = delegate(string name, Mesh m) { //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_0017: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) GameObject val9 = new GameObject(name) { layer = modelObject.layer }; val9.transform.SetParent(root, false); SkinnedMeshRenderer obj2 = val9.AddComponent<SkinnedMeshRenderer>(); obj2.sharedMesh = m; obj2.bones = bones2; obj2.rootBone = bones2[0]; ((Renderer)obj2).sharedMaterial = Material(); obj2.quality = (SkinQuality)4; obj2.updateWhenOffscreen = true; ((Renderer)obj2).localBounds = new Bounds(new Vector3(0f, 1.2f, 0f), Vector3.one * 60f); ((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)1; return obj2; }; SjornModelIdentity sjornModelIdentity = modelObject.AddComponent<SjornModelIdentity>(); sjornModelIdentity.BodyRenderer = func("SjornBodyRenderer", val4); sjornModelIdentity.AxeRenderer = func("SjornAxeRenderer", val5); sjornModelIdentity.BottleRenderer = func("SjornBottleRenderer", val6); sjornModelIdentity.Bones = bones2; sjornModelIdentity.BoneNames = source.Joints.Select((Joint joint) => joint.Name).ToArray(); sjornModelIdentity.LegacyRenderers = componentsInChildren2; sjornModelIdentity.AxeHand = bones2[Array.FindIndex(source.Joints, (Joint joint) => joint.Name == "hand.r")]; sjornModelIdentity.BottleHand = bones2[Array.FindIndex(source.Joints, (Joint joint) => joint.Name == "hand.l")]; sjornModelIdentity.AxeBone = bones2[num]; sjornModelIdentity.BottleBone = bones2[num2]; Vector3 val7 = source.Joints[num].Tail - source.Joints[num].Head; sjornModelIdentity.AxeDirection = ((Vector3)(ref val7)).normalized; val7 = source.Joints[num2].Tail - source.Joints[num2].Head; sjornModelIdentity.BottleDirection = ((Vector3)(ref val7)).normalized; sjornModelIdentity.AxeTip = Tip(bones2[num], root.TransformPoint(source.Joints[num].Tail)); sjornModelIdentity.BottleTip = Tip(bones2[num2], root.TransformPoint(source.Joints[num2].Tail)); sjornModelIdentity.AxeGripOffset = sjornModelIdentity.AxeBone.localPosition; sjornModelIdentity.BottleGripOffset = sjornModelIdentity.BottleBone.localPosition; sjornModelIdentity.Mouth = Tip(sjornModelIdentity.Bone("head"), root.TransformPoint(new Vector3(0.0436099f, 2.1522577f, 0.220809f))); sjornModelIdentity.BottleMouth = Tip(sjornModelIdentity.BottleBone, root.TransformPoint(new Vector3(-0.6782274f, 1.4644156f, 0.1750159f))); SjornProportions sjornProportions = modelObject.AddComponent<SjornProportions>(); sjornProportions.Native = array2; sjornProportions.Bones = bones2; sjornProportions.Names = sjornModelIdentity.BoneNames; sjornProportions.NativeRest = array3; sjornProportions.LocalRest = array4; MonoBehaviour[] componentsInChildren4 = ((Component)root).GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val8 in componentsInChildren4) { if (((object)val8).GetType().Name == "InverseKinematics") { ((Behaviour)val8).enabled = false; } } RendererInfo[] baseRendererInfos = ((IEnumerable<SkinnedMeshRenderer>)(object)new SkinnedMeshRenderer[3] { sjornModelIdentity.BodyRenderer, sjornModelIdentity.AxeRenderer, sjornModelIdentity.BottleRenderer }).Select((Func<SkinnedMeshRenderer, RendererInfo>)((SkinnedMeshRenderer r) => new RendererInfo { renderer = (Renderer)(object)r, defaultMaterial = material, defaultShadowCastingMode = (ShadowCastingMode)1 })).ToArray(); component.baseRendererInfos = baseRendererInfos; modelObject.GetComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[1] { NewSkin(modelObject, "Default", "REDZERGLING_SJORN_SKIN", material, "portrait") }; LanguageAPI.Add("REDZERGLING_SJORN_SKIN", "Sjorn"); modelObject.GetComponent<Animator>().cullingMode = (AnimatorCullingMode)0; modelObject.AddComponent<SjornPose>(); } private static Transform Tip(Transform parent, Vector3 point) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject("SjornWeaponTip").transform; transform.SetParent(parent, false); transform.position = point; return transform; } private static SkinDef NewSkin(GameObject root, string name, string token, Material mat, string icon) { //IL_0031: 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) RendererInfo[] array = ((IEnumerable<RendererInfo>)root.GetComponent<CharacterModel>().baseRendererInfos).Select((Func<RendererInfo, RendererInfo>)((RendererInfo r) => new RendererInfo { renderer = r.renderer, defaultMaterial = mat, defaultShadowCastingMode = r.defaultShadowCastingMode })).ToArray(); return Skins.CreateNewSkinDef(new SkinDefParamsInfo { Name = "RedzerglingSjorn" + name + ((Object)root).name, NameToken = token, RootObject = root, Icon = SkillIcons.Load(icon), BaseSkins = Array.Empty<SkinDef>(), RendererInfos = array, MeshReplacements = array.Where((RendererInfo i) => i.renderer is SkinnedMeshRenderer).Select((Func<RendererInfo, MeshReplacement>)((RendererInfo i) => new MeshReplacement { renderer = i.renderer, mesh = ((SkinnedMeshRenderer)i.renderer).sharedMesh })).ToArray(), GameObjectActivations = Array.Empty<GameObjectActivation>(), ProjectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(), MinionSkinReplacements = Array.Empty<MinionSkinReplacement>() }); } internal static void SetDisplay(GameObject root) { SjornModelIdentity component = root.GetComponent<SjornModelIdentity>(); if (Object.op_Implicit((Object)(object)component)) { component.IsDisplay = true; } SjornPose component2 = root.GetComponent<SjornPose>(); if (Object.op_Implicit((Object)(object)component2)) { component2.IsDisplay = true; } CharacterModel component3 = root.GetComponent<CharacterModel>(); if (Object.op_Implicit((Object)(object)component3)) { component3.body = null; } } } internal sealed class SjornModelIdentity : MonoBehaviour { public SkinnedMeshRenderer BodyRenderer; public SkinnedMeshRenderer AxeRenderer; public SkinnedMeshRenderer BottleRenderer; public Renderer[] LegacyRenderers; public Transform[] Bones; public string[] BoneNames; public Transform AxeHand; public Transform BottleHand; public Transform AxeBone; public Transform BottleBone; public Transform AxeTip; public Transform BottleTip; public Transform Mouth; public Transform BottleMouth; public Vector3 AxeDirection; public Vector3 BottleDirection; public Vector3 AxeGripOffset; public Vector3 BottleGripOffset; public bool AxeVisualReleased; public bool BottleVisualReleased; public bool IsDisplay; internal Transform Bone(string name) { return Bones[Array.IndexOf(BoneNames, name)]; } private void Awake() { Suppress(); } private void OnEnable() { Suppress(); } private void Suppress() { if (LegacyRenderers == null) { return; } Renderer[] legacyRenderers = LegacyRenderers; foreach (Renderer val in legacyRenderers) { if (Object.op_Implicit((Object)(object)val)) { val.forceRenderingOff = true; } } } } [DefaultExecutionOrder(9000)] internal sealed class SjornPose : MonoBehaviour { public bool IsDisplay; private readonly LegacyMotionClock locomotion = new LegacyMotionClock(); private SjornModelIdentity id; private CharacterBody body; private EntityStateMachine[] machines; private Vector3 bottleMouthFromHand; private Quaternion[] previous; private Quaternion[] returnFrom; private bool acting; private float returnAt = -10f; private float deathAt = -1f; internal int ActiveKind; internal float ActiveProgress; internal int ActiveVariant; private static readonly string[] MovementClips = new string[8] { "idle", "walk", "run", "sprint", "rise", "fall", "land", "death" }; private static readonly Vector3 SelectionGripShift = new Vector3(0.0055173f, 0.25482482f, -1.3562573f); private static readonly Vector3 SelectionWrist = new Vector3(0.77f, 1.1198655f, 0.19f); private static readonly Quaternion SelectionFist = new Quaternion(0.5268012f, 0.02960471f, 0.00770542f, 0.84943783f); private readonly RetargetClip[] clips = new RetargetClip[20]; private RetargetPosePlayer player; private Vector3[] priorPositions; private Vector3[] transitionPositions; private Quaternion[] priorRotations; private Quaternion[] transitionRotations; private float transitionAt = -10f; private float transitionDuration; private float airAt; private float landAt = -10f; private float gaitPhase; private float airWeight; private float gaitSpeed; private float gaitSprint; private bool wasGrounded = true; private bool wasDead; private bool havePose; private SjornState lastSkill; internal bool RetargetActive { get; private set; } internal string ActiveRetargetClip { get; private set; } internal float RetargetPhase { get; private set; } private void Start() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) id = ((Component)this).GetComponent<SjornModelIdentity>(); CharacterModel component = ((Component)this).GetComponent<CharacterModel>(); body = (Object.op_Implicit((Object)(object)component) ? component.body : null); machines = (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponents<EntityStateMachine>() : Array.Empty<EntityStateMachine>()); bottleMouthFromHand = id.BottleHand.InverseTransformPoint(id.BottleMouth.position); previous = id.Bones.Select((Transform b) => b.localRotation).ToArray(); returnFrom = (Quaternion[])(object)new Quaternion[previous.Length]; for (int num = 0; num < clips.Length; num++) { string name = ((num < MovementClips.Length) ? MovementClips[num] : ("skill" + (num - MovementClips.Length).ToString("D2"))); clips[num] = RetargetLibrary.Load("sjorn", name); } RetargetActive = clips.All((RetargetClip clip) => clip != null && id.BoneNames.All((string name2) => clip.BoneIndex(name2) >= 0)); if (RetargetActive) { player = new RetargetPosePlayer(id.Bones, id.BoneNames); priorPositions = (Vector3[])(object)new Vector3[id.Bones.Length]; transitionPositions = (Vector3[])(object)new Vector3[id.Bones.Length]; priorRotations = (Quaternion[])(object)new Quaternion[id.Bones.Length]; transitionRotations = (Quaternion[])(object)new Quaternion[id.Bones.Length]; SjornProportions component2 = ((Component)this).GetComponent<SjornProportions>(); if (Object.op_Implicit((Object)(object)component2)) { component2.RetargetOwnsPose = true; } } if (!IsDisplay) { return; } id.IsDisplay = true; Animator component3 = ((Component)this).GetComponent<Animator>(); if (!Object.op_Implicit((Object)(object)component3)) { return; } component3.SetBool("isGrounded", true); component3.SetBool("isMoving", false); string[] array = new string[2] { "AimPitch", "AimYaw" }; foreach (string text in array) { int layerIndex = component3.GetLayerIndex(text); if (layerIndex >= 0) { component3.SetLayerWeight(layerIndex, 0f); } } } private void LateUpdate() { //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)id) || id.Bones == null) { return; } if (RetargetActive) { ApplyRetarget(); return; } if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive) { if (deathAt < 0f) { deathAt = Time.time; } id.Bone("ROOT").localRotation = Quaternion.Euler(70f * Mathf.SmoothStep(0f, 1f, (Time.time - deathAt) / 0.7f), 0f, 0f); return; } deathAt = -1f; ISjornPose sjornPose = null; if (machines != null) { EntityStateMachine[] array = machines; foreach (EntityStateMachine val in array) { if (Object.op_Implicit((Object)(object)val) && val.state is ISjornPose) { sjornPose = (ISjornPose)val.state; } } } locomotion.Tick(body); float move = locomotion.Move; Transform obj = id.Bone("chest"); obj.localRotation *= Quaternion.Euler(Mathf.Sin(Time.time * 1.5f) * 0.6f, 0f, 0f); Transform obj2 = id.Bone("lower_arm.r"); obj2.localRotation *= Quaternion.Euler(Mathf.Sin(Time.time * 4f) * move * 3f, 0f, 0f); Transform obj3 = id.Bone("lower_arm.l"); obj3.localRotation *= Quaternion.Euler((0f - Mathf.Sin(Time.time * 4f)) * move * 2f, 0f, 0f); Transform obj4 = id.Bone("chest"); obj4.localRotation *= Quaternion.Euler(2f * locomotion.Sprint - locomotion.Rise + 1.2f * locomotion.Fall + 2f * locomotion.Land, 0f, locomotion.Stride * 0.4f); Transform obj5 = id.Bone("head"); obj5.localRotation *= Quaternion.Euler(0f - locomotion.Rise + locomotion.Land, 0f, 0f); ActiveKind = sjornPose?.ActionKind ?? 0; ActiveProgress = sjornPose?.Progress ?? 0f; ActiveVariant = sjornPose?.Variant ?? 0; if (sjornPose != null) { Apply(sjornPose); } if (acting && sjornPose == null) { returnAt = Time.time; Array.Copy(previous, returnFrom, previous.Length); } if (sjornPose == null && Time.time - returnAt < 0.16f) { float num = Mathf.SmoothStep(0f, 1f, (Time.time - returnAt) / 0.16f); for (int j = 0; j < id.Bones.Length; j++) { id.Bones[j].localRotation = Quaternion.Slerp(returnFrom[j], id.Bones[j].localRotation, num); } } for (int k = 0; k < previous.Length; k++) { previous[k] = id.Bones[k].localRotation; } acting = sjornPose != null; id.AxeBone.localPosition = id.AxeGripOffset; id.BottleBone.localPosition = id.BottleGripOffset; Transform axeBone = id.AxeBone; Quaternion localRotation = (id.BottleBone.localRotation = Quaternion.identity); axeBone.localRotation = localRotation; } private void ApplyRetarget() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) player.BeginFrame(); if (IsDisplay) { ApplySelection(); return; } SjornState sjornState = null; if (machines != null) { EntityStateMachine[] array = machines; foreach (EntityStateMachine val in array) { if (Object.op_Implicit((Object)(object)val) && val.state is SjornState sjornState2) { sjornState = sjornState2; } } } CharacterMotor val2 = (Object.op_Implicit((Object)(object)body) ? body.characterMotor : null); bool flag = !Object.op_Implicit((Object)(object)val2) || val2.isGrounded; Vector3 val3 = (Object.op_Implicit((Object)(object)val2) ? val2.velocity : Vector3.zero); Vector3 val4 = Vector3.ProjectOnPlane(val3, Vector3.up); float magnitude = ((Vector3)(ref val4)).magnitude; if (!flag && wasGrounded) { airAt = Time.time; } if (flag && !wasGrounded) { landAt = Time.time; } wasGrounded = flag; bool flag2 = Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive; if (flag2 && deathAt < 0f) { deathAt = Time.time; } if (!flag2) { deathAt = -1f; } if (sjornState != lastSkill || flag2 != wasDead) { if (havePose) { Array.Copy(priorPositions, transitionPositions, priorPositions.Length); Array.Copy(priorRotations, transitionRotations, priorRotations.Length); transitionAt = Time.time; transitionDuration = (flag2 ? 0.1f : ((sjornState == null) ? 0.15f : ((sjornState.ActionKind == 3) ? 0.055f : Mathf.Min(0.09f, Mathf.Max(0.01f, sjornState.PresentationDuration * sjornState.ContactFraction * 0.7f))))); } lastSkill = sjornState; } wasDead = flag2; ActiveKind = sjornState?.ActionKind ?? 0; ActiveProgress = sjornState?.Progress ?? 0f; ActiveVariant = sjornState?.Variant ?? 0; gaitSpeed = Mathf.MoveTowards(gaitSpeed, flag ? magnitude : 0f, Time.deltaTime * ((magnitude > gaitSpeed) ? 23f : 31f)); gaitSprint = Mathf.MoveTowards(gaitSprint, (float)((flag && Object.op_Implicit((Object)(object)body) && body.isSprinting) ? 1 : 0), Time.deltaTime * 5f); float num = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.2f, 2.35f, gaitSpeed)); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(2.1f, 4.6f, gaitSpeed)); float num3 = gaitSprint; float num4 = Mathf.Lerp(Mathf.Lerp(2.3f, 4.6f, num2), 6.7f, num3); float num5 = Mathf.Lerp(Mathf.Lerp(clips[1].Duration, clips[2].Duration, num2), clips[3].Duration, num3); gaitPhase = Mathf.Repeat(gaitPhase + Time.deltaTime * Mathf.Clamp(gaitSpeed / num4, 0f, 1.8f) / num5, 1f); float num6 = Mathf.Repeat(Time.time / clips[0].Duration, 1f); player.Apply(clips[0], num6); player.Apply(clips[1], gaitPhase, num); player.Apply(clips[2], gaitPhase, num * num2); player.Apply(clips[3], gaitPhase, num * num3); string text = ((num < 0.15f) ? "idle" : ((num3 > 0.5f) ? "sprint" : ((num2 > 0.5f) ? "run" : "walk"))); float num7 = ((text == "idle") ? num6 : gaitPhase); airWeight = Mathf.MoveTowards(airWeight, (float)((!flag) ? 1 : 0), Time.deltaTime * 11f); if (airWeight > 0f) { int num8 = ((val3.y > 0.5f) ? 4 : 5); float num9 = Time.time - airAt; float num10 = ((num8 == 4) ? Mathf.Clamp01(num9 / 0.38f) : Mathf.Clamp01(num9 / clips[5].Duration)); player.Apply(clips[num8], num10, airWeight); if (airWeight > 0.45f) { text = MovementClips[num8]; num7 = num10; } } float num11 = Time.time - landAt; if (flag && num11 >= 0f && num11 < 0.31f) { float num12 = (1f - Mathf.SmoothStep(0f, 1f, num11 / 0.31f)) * (1f - 0.65f * num); player.Apply(clips[6], Mathf.Clamp01(num11 / 0.31f), num12); if (num12 > 0.45f) { text = "land"; num7 = num11 / 0.31f; } } if (flag2) { text = "death"; num7 = Mathf.Clamp01((Time.time - deathAt) / clips[7].Duration); player.Apply(clips[7], num7); } else if (sjornState != nu