using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using HG; using HG.BlendableTypes; using KinematicCharacterController; using R2API; using R2API.Utils; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Skills; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace Timpanist; public static class Combat { private static readonly Collider[] overlaps = (Collider[])(object)new Collider[512]; public static Ray Aim(CharacterBody body) { //IL_0008: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Ray val = default(Ray); ((Ray)(ref val))..ctor(body.inputBank.aimOrigin, body.inputBank.aimDirection); float num = default(float); val = CameraRigController.ModifyAimRayIfApplicable(val, ((Component)body).gameObject, ref num); Vector3 point = ((Ray)(ref val)).GetPoint(1000f); GameObject gameObject = ((Component)body).gameObject; Ray val2 = val; LayerIndex val3 = LayerIndex.world; int num2 = LayerMask.op_Implicit(((LayerIndex)(ref val3)).mask); val3 = LayerIndex.entityPrecise; RaycastHit val4 = default(RaycastHit); if (Util.CharacterRaycast(gameObject, val2, ref val4, 1000f, LayerMask.op_Implicit(num2 | LayerMask.op_Implicit(((LayerIndex)(ref val3)).mask)), (QueryTriggerInteraction)1)) { point = ((RaycastHit)(ref val4)).point; } Vector3 aimOrigin = body.aimOrigin; Vector3 val5 = point - body.aimOrigin; return new Ray(aimOrigin, ((Vector3)(ref val5)).normalized); } public static DamageTypeCombo Type(DamageSource source, bool stun = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)(stun ? 32 : 0)), (DamageTypeExtended)0, source); } public unsafe static bool Hit(CharacterBody body, HealthComponent health, Vector3 point, float coefficient, float proc, DamageSource source, bool crit, bool stun, Vector3 force, ProcChainMask mask, GameObject inflictor = null, HurtBox hurtBox = null) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 if (!NetworkServer.active || !Object.op_Implicit((Object)(object)health) || (Object)(object)health == (Object)(object)body.healthComponent || !health.alive) { return false; } DamageInfo val = new DamageInfo { attacker = ((Component)body).gameObject, inflictor = (Object.op_Implicit((Object)(object)inflictor) ? inflictor : ((Component)body).gameObject), damage = body.damage * coefficient, crit = crit, position = point, force = force, procCoefficient = proc, procChainMask = mask, damageType = Type(source, stun), damageColorIndex = (DamageColorIndex)0 }; if (Object.op_Implicit((Object)(object)hurtBox)) { val.inflictedHurtbox = hurtBox; if (hurtBox.AttackHitRejectsHurtbox(new HurtBoxAttackHitProcessorArgs(val, body.aimOrigin))) { return false; } val.ModifyDamageInfo(hurtBox.damageModifier); } health.TakeDamage(val); GlobalEventManager.instance.OnHitEnemy(val, ((Component)health).gameObject); GlobalEventManager.instance.OnHitAll(val, ((Component)health).gameObject); TimpanistController component = ((Component)body).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.Trace("direct-hit", ((object)(*(DamageSource*)(&source))/*cast due to .constrained prefix*/).ToString(), ((int)source == 1) ? body.skillLocator.primary : (((int)source == 4) ? body.skillLocator.utility : body.skillLocator.secondary), 0f, coefficient, proc, crit, ((Object)health).GetInstanceID()); } return true; } public unsafe static void Area(CharacterBody body, Vector3 origin, Vector3 aim, float radius, float halfAngle, float coefficient, float proc, DamageSource source, bool crit, bool stun, HashSet seen, float knockback = 10f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0160: 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) float num = radius; Collider[] array = overlaps; LayerIndex val = LayerIndex.entityPrecise; int num2 = Physics.OverlapSphereNonAlloc(origin, num, array, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)2); int count = seen.Count; Collider[] array2 = overlaps; if (num2 == overlaps.Length) { float num3 = radius; val = LayerIndex.entityPrecise; array2 = Physics.OverlapSphere(origin, num3, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)2); num2 = array2.Length; } for (int i = 0; i < num2; i++) { HurtBox component = ((Component)array2[i]).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.healthComponent)) { continue; } HealthComponent healthComponent = component.healthComponent; if (seen.Contains(healthComponent) || (Object)(object)healthComponent == (Object)(object)body.healthComponent || !FriendlyFireManager.ShouldSplashHitProceed(healthComponent, body.teamComponent.teamIndex)) { continue; } Vector3 val2 = array2[i].ClosestPoint(origin); Vector3 val3 = val2 - origin; if (halfAngle < 180f && Vector3.Angle(aim, val3) > halfAngle) { continue; } val = LayerIndex.world; if (!Physics.Linecast(origin, val2, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)1)) { Vector3 force = (stun ? (((Vector3)(ref val3)).normalized * 800f + Vector3.up * 250f) : (((Vector3)(ref val3)).normalized * knockback)); if (Hit(body, healthComponent, val2, coefficient, proc, source, crit, stun, force, default(ProcChainMask), null, component)) { seen.Add(healthComponent); } } } if (Plugin.Diagnostics.Value && proc >= 1f) { Plugin.Log("strike-query source=" + ((object)(*(DamageSource*)(&source))/*cast due to .constrained prefix*/).ToString() + " candidates=" + num2 + " selected=" + (seen.Count - count) + " radius=" + radius + " angle=" + halfAngle); } } public static void Sweep(CharacterBody body, Vector3 from, Vector3 to, float radius, float coefficient, float proc, bool crit, HashSet seen, HashSet afterbeatHits) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0128: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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) Vector3 val = to - from; int num = Mathf.Max(1, Mathf.CeilToInt(((Vector3)(ref val)).magnitude / 0.4f)); for (int i = 0; i <= num; i++) { Vector3 val2 = Vector3.Lerp(from, to, (float)i / (float)num); Vector3 val3 = val2 - Vector3.up * 0.45f; Vector3 val4 = val2 + Vector3.up * 0.45f; Collider[] array = overlaps; LayerIndex val5 = LayerIndex.entityPrecise; int num2 = Physics.OverlapCapsuleNonAlloc(val3, val4, radius, array, LayerMask.op_Implicit(((LayerIndex)(ref val5)).mask), (QueryTriggerInteraction)2); Collider[] array2 = overlaps; if (num2 == overlaps.Length) { val5 = LayerIndex.entityPrecise; array2 = Physics.OverlapCapsule(val3, val4, radius, LayerMask.op_Implicit(((LayerIndex)(ref val5)).mask), (QueryTriggerInteraction)2); num2 = array2.Length; } for (int j = 0; j < num2; j++) { HurtBox component = ((Component)array2[j]).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.healthComponent) || seen.Contains(component.healthComponent) || (Object)(object)component.healthComponent == (Object)(object)body.healthComponent || !FriendlyFireManager.ShouldSplashHitProceed(component.healthComponent, body.teamComponent.teamIndex)) { continue; } Vector3 val6 = array2[j].ClosestPoint(val2); val5 = LayerIndex.world; if (!Physics.Linecast(val2, val6, LayerMask.op_Implicit(((LayerIndex)(ref val5)).mask), (QueryTriggerInteraction)1)) { Vector3 corePosition = body.corePosition; val5 = LayerIndex.world; if (!Physics.Linecast(corePosition, val6, LayerMask.op_Implicit(((LayerIndex)(ref val5)).mask), (QueryTriggerInteraction)1) && Hit(body, component.healthComponent, val6, coefficient, proc, (DamageSource)4, crit, stun: false, ((Vector3)(ref val)).normalized * 150f, default(ProcChainMask), null, component)) { seen.Add(component.healthComponent); ((Component)body).GetComponent().QueueAfterbeat(component.healthComponent, val6, crit, afterbeatHits); } } } } } public static void Strike(CharacterBody body, Tuning mode, bool right) { //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_0010: 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_007f: 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) Ray val = Aim(body); HashSet hashSet = new HashSet(); Area(body, ((Ray)(ref val)).origin, ((Ray)(ref val)).direction, 22f, 38f, 4f, 1f, (DamageSource)1, body.RollCrit(), stun: false, hashSet, 100f); int num = 0; foreach (HealthComponent item in hashSet) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.body) && num++ < 12) { ImpactVisual.Emit(body, item.body.corePosition, ((Ray)(ref val)).direction, 0.8f, ImpactKind.HeavyContact); } } } public static void Roll(CharacterBody body) { //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_0010: 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) Ray val = Aim(body); HashSet hashSet = new HashSet(); Area(body, ((Ray)(ref val)).origin, ((Ray)(ref val)).direction, 14f, 50f, CavalryRules.RollDamage(body.attackSpeed), 0.12f, (DamageSource)2, body.RollCrit(), stun: false, hashSet, 130f); foreach (HealthComponent item in hashSet) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.body)) { item.body.AddTimedBuff(Content.MidFull, 0.35f); } } } } public static class Content { public static DrumSkillDef Left; public static RollSkillDef Right; public static SkillDef Charge; public static SkillDef Retune; public static BuffDef Poise; public static BuffDef LowFull; public static BuffDef LowHalf; public static BuffDef MidFull; public static BuffDef MidHalf; public static BuffDef LowResonant; public static BuffDef MidResonant; private static void Field(object target, string name, object value) { FieldInfo? field = target.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { throw new MissingFieldException(target.GetType().FullName, name); } field.SetValue(target, value); } public static void Build(ContentPack pack) { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0303: 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_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0463: 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_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Expected O, but got Unknown //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_07f7: Unknown result type (might be due to invalid IL or missing references) SurvivorIdentity.RegisterLanguage(); LanguageAPI.Add("TIMPANIST_NAME", "The Timpanist"); LanguageAPI.Add("TIMPANIST_SUBTITLE", "Cavalry Percussionist"); LanguageAPI.Add("TIMPANIST_DESCRIPTION", "A mounted percussionist who breaks enemy lines with heavy sound waves. Strike hard, control crowds with a roll, and charge through them for a delayed Afterbeat."); LanguageAPI.Add("TIMPANIST_OUTRO", "...and so they left, the last note still ringing."); LanguageAPI.Add("TIMPANIST_FAILURE", "...and so they vanished, an unfinished cadence."); LanguageAPI.Add("TIMPANIST_DEFAULT", "Cavalry Percussionist"); GameObject obj = LegacyResourcesAPI.Load("Prefabs/CharacterBodies/CommandoBody"); if (!Object.op_Implicit((Object)(object)obj)) { throw new InvalidOperationException("CommandoBody runtime reference unavailable"); } GameObject val = PrefabAPI.InstantiateClone(obj, "RodaniusTimpanistBody", true); CharacterBody component = val.GetComponent(); component.baseNameToken = "TIMPANIST_NAME"; component.subtitleNameToken = "TIMPANIST_SUBTITLE"; component.baseMaxHealth = 130f; component.levelMaxHealth = 39f; component.baseRegen = 1f; component.levelRegen = 0.2f; component.baseDamage = 12f; component.levelDamage = 2.4f; component.baseCrit = 1f; component.levelCrit = 0f; component.baseArmor = 0f; component.levelArmor = 0f; component.baseMoveSpeed = 8.5f; component.levelMoveSpeed = 0f; component.baseAcceleration = 110f; component.baseJumpPower = 15f; component.levelJumpPower = 0f; component.baseJumpCount = 1; component.sprintingSpeedMultiplier = 1.6f; component.baseAttackSpeed = 1f; component.levelAttackSpeed = 0f; component.autoCalculateLevelStats = false; component.bodyColor = Graybox.Green; val.GetComponent().mass = 100f; Rigidbody component2 = val.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.mass = 100f; } KinematicCharacterMotor component3 = val.GetComponent(); component3.Capsule = val.GetComponent(); component3.SetCapsuleDimensions(0.48f, 2.2f, 0f); val.GetComponent().modelTransform.parent.localPosition = new Vector3(0f, -1.1f, 0f); component.aimOriginTransform = Anchor(val.transform, "TimpanistAim", new Vector3(0f, 0.65f, 0f)); component.overrideCoreTransform = Anchor(val.transform, "TimpanistCore", Vector3.zero); List list = new List(val.GetComponents()); EntityStateMachine val2 = null; EntityStateMachine bodyMachine = null; foreach (EntityStateMachine item in list) { if (item.customName == "Body") { item.mainStateType = new SerializableEntityStateType(typeof(TimpanistMain)); bodyMachine = item; } if (item.customName == "Weapon") { val2 = item; } } if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)bodyMachine)) { throw new InvalidOperationException("Template state-machine contract changed"); } val2.initialStateType = (val2.mainStateType = new SerializableEntityStateType(typeof(Idle))); string[] array = new string[1] { "Cavalry" }; foreach (string customName in array) { EntityStateMachine val3 = val.AddComponent(); val3.customName = customName; val3.initialStateType = (val3.mainStateType = new SerializableEntityStateType(typeof(Idle))); list.Add(val3); } Field(val.GetComponent(), "stateMachines", list.ToArray()); SetStateOnHurt component4 = val.GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { component4.idleStateMachine = list.FindAll((EntityStateMachine x) => (Object)(object)x != (Object)(object)bodyMachine && x.customName != "Tuning").ToArray(); } CharacterDeathBehavior component5 = val.GetComponent(); if (Object.op_Implicit((Object)(object)component5)) { component5.idleStateMachine = list.FindAll((EntityStateMachine x) => (Object)(object)x != (Object)(object)bodyMachine).ToArray(); } Transform modelTransform = val.GetComponent().modelTransform; Material template = (PressureVisual.Template = ((Component)modelTransform).GetComponent().baseRendererInfos[0].defaultMaterial); ImpactVisual.Build(pack); Graybox.BuildModel(val, modelTransform, template); val.AddComponent(); CameraTargetParams component6 = val.GetComponent(); component6.cameraParams = Object.Instantiate(component6.cameraParams); CharacterCameraParamsData data = component6.cameraParams.data; data.pivotVerticalOffset = BlendableFloat.op_Implicit(1.65f); data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(Plugin.CameraOffset.Value, 0f, 0f - Plugin.CameraDistance.Value)); component6.cameraParams.data = data; SkillLocator component7 = val.GetComponent(); GenericSkill[] components = val.GetComponents(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } Left = Make("LEFT", "Hammerstroke", "Strike a broad sound wave for 400% damage. Hold to repeat.", "Weapon", typeof(StrokeState), 0f, 0, end: false); Right = Make("RIGHT", "Pressure Roll", "Hold for up to 2s: deal 120% damage per second, slow enemies by 30%, and push them back.", "Weapon", typeof(RollState), 6f, 1, end: true); ((SkillDef)Right).mustKeyPress = true; ((SkillDef)Right).autoHandleLuminousShot = true; ((SkillDef)Right).interruptPriority = (InterruptPriority)2; Charge = Make("CHARGE", "Thunderous Charge", "Charge forward for 350% damage. Hits erupt in an 180% Afterbeat. Primary ends the charge early.", "Cavalry", typeof(ChargeState), 7f, 1, end: false); Charge.mustKeyPress = true; Retune = Make("RETUNE", "Grand Accent", "Strike both drums for a staggering 900% damage wave.", "Weapon", typeof(GrandAccentState), 10f, 1, end: false); Retune.mustKeyPress = true; Retune.interruptPriority = (InterruptPriority)2; component7.primary = Slot(val, (SkillDef)(object)Left, pack); component7.secondary = Slot(val, (SkillDef)(object)Right, pack); component7.utility = Slot(val, Charge, pack); component7.special = Slot(val, Retune, pack); Poise = ScriptableObject.CreateInstance(); ((Object)Poise).name = "RodaniusMountedPoise"; Poise.canStack = false; Poise.isDebuff = false; Poise.buffColor = Graybox.Green; Poise.iconSprite = Graybox.Icon(Graybox.Green); LowFull = Buff("TimpanistLowFull", debuff: false, new Color(0.35f, 0.95f, 0.85f)); LowResonant = Buff("TimpanistLowResonant", debuff: false, new Color(0.3f, 1f, 1f)); MidResonant = Buff("TimpanistMidResonant", debuff: true, new Color(1f, 0.9f, 0.4f)); LowHalf = Buff("TimpanistLowHalf", debuff: false, new Color(0.35f, 0.7f, 0.65f)); MidFull = Buff("TimpanistMidFull", debuff: true, new Color(1f, 0.75f, 0.25f)); MidHalf = Buff("TimpanistMidHalf", debuff: true, new Color(0.8f, 0.6f, 0.25f)); GameObject val4 = new GameObject("RodaniusTimpanistDisplay"); val4.SetActive(false); if (!Presentation.TryBuild(val4.transform, template)) { Graybox.BuildVisual(val4.transform, template); } Object.DontDestroyOnLoad((Object)(object)val4); GameObject val5 = PrefabAPI.InstantiateClone(val4, "RodaniusTimpanistDisplayPrefab", false); val5.SetActive(true); Object.Destroy((Object)(object)val4); SurvivorDef val6 = ScriptableObject.CreateInstance(); ((Object)val6).name = "RodaniusTimpanist"; val6.bodyPrefab = val; val6.displayPrefab = val5; val6.displayNameToken = "TIMPANIST_NAME"; val6.descriptionToken = "TIMPANIST_DESCRIPTION"; val6.outroFlavorToken = "TIMPANIST_OUTRO"; val6.mainEndingEscapeFailureFlavorToken = "TIMPANIST_FAILURE"; val6.primaryColor = Graybox.Green; val6.desiredSortPosition = 100f; val6.hidden = false; component.portraitIcon = (Texture)(object)SurvivorIdentity.LoadPortrait(); GameObject val7 = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/CommandoMonsterMaster"), "RodaniusTimpanistMonsterMaster", true); val7.GetComponent().bodyPrefab = val; AISkillDriver[] components2 = val7.GetComponents(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } Driver(val7, "Crowd control", (SkillSlot)1, 0f, 10f); Driver(val7, "Hammerstroke", (SkillSlot)0, 0f, 22f); Driver(val7, "Charge", (SkillSlot)2, 22f, 40f); Driver(val7, "Approach", (SkillSlot)(-1), 22f, float.PositiveInfinity); pack.bodyPrefabs.Add((GameObject[])(object)new GameObject[1] { val }); pack.masterPrefabs.Add((GameObject[])(object)new GameObject[1] { val7 }); pack.survivorDefs.Add((SurvivorDef[])(object)new SurvivorDef[1] { val6 }); pack.buffDefs.Add((BuffDef[])(object)new BuffDef[7] { Poise, LowFull, LowHalf, MidFull, MidHalf, LowResonant, MidResonant }); pack.skillDefs.Add((SkillDef[])(object)new SkillDef[4] { Left, Right, Charge, Retune }); pack.entityStateTypes.Add(new Type[5] { typeof(TimpanistMain), typeof(StrokeState), typeof(RollState), typeof(ChargeState), typeof(GrandAccentState) }); Plugin.Log("Registered Timpanist content; runtime acceptance NOT yet established."); } private static T Make(string id, string title, string description, string machine, Type state, float recharge, int consume, bool end) where T : SkillDef { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) T val = ScriptableObject.CreateInstance(); ((Object)(object)val).name = "RodaniusTimpanist" + id; ((SkillDef)val).skillName = "TIMPANIST_" + id; ((SkillDef)val).skillNameToken = ((SkillDef)val).skillName + "_NAME"; ((SkillDef)val).skillDescriptionToken = ((SkillDef)val).skillName + "_DESCRIPTION"; LanguageAPI.Add(((SkillDef)val).skillNameToken, title); LanguageAPI.Add(((SkillDef)val).skillDescriptionToken, description); ((SkillDef)val).activationStateMachineName = machine; ((SkillDef)val).activationState = new SerializableEntityStateType(state); ((SkillDef)val).baseMaxStock = 1; ((SkillDef)val).baseRechargeInterval = recharge; ((SkillDef)val).rechargeStock = 1; ((SkillDef)val).requiredStock = consume; ((SkillDef)val).stockToConsume = consume; ((SkillDef)val).fullRestockOnAssign = true; ((SkillDef)val).resetCooldownTimerOnUse = false; ((SkillDef)val).beginSkillCooldownOnSkillEnd = end; ((SkillDef)val).isCombatSkill = true; ((SkillDef)val).cancelSprintingOnActivation = false; ((SkillDef)val).canceledFromSprinting = false; ((SkillDef)val).interruptPriority = (InterruptPriority)1; ((SkillDef)val).icon = SkillIcons.Load(id); return val; } private static GenericSkill Slot(GameObject body, SkillDef def, ContentPack pack) { //IL_003a: 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_005c: Expected O, but got Unknown //IL_005c: 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) GenericSkill val = body.AddComponent(); val.skillName = def.skillName; SkillFamily val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = def.skillName + "Family"; Variant[] array = new Variant[1]; Variant val3 = new Variant { skillDef = def }; ((Variant)(ref val3)).viewableNode = new Node(def.skillNameToken, false, (Node)null); array[0] = val3; val2.variants = (Variant[])(object)array; Field(val, "_skillFamily", val2); pack.skillFamilies.Add((SkillFamily[])(object)new SkillFamily[1] { val2 }); return val; } private static void Driver(GameObject master, string name, SkillSlot slot, float min, float max) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) AISkillDriver obj = master.AddComponent(); obj.customName = name; obj.skillSlot = slot; obj.requireSkillReady = (int)slot != -1; obj.minDistance = min; obj.maxDistance = max; obj.selectionRequiresTargetLoS = true; obj.activationRequiresTargetLoS = true; obj.moveTargetType = (TargetType)0; obj.movementType = (MovementType)1; obj.aimType = (AimType)2; obj.shouldSprint = true; obj.moveInputScale = 1f; obj.driverUpdateTimerOverride = 0.2f; } public static Transform Anchor(Transform parent, string name, Vector3 position) { //IL_0001: 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) Transform transform = new GameObject(name).transform; transform.SetParent(parent, false); transform.localPosition = position; return transform; } private static BuffDef Buff(string name, bool debuff, Color color) { //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_0022: Unknown result type (might be due to invalid IL or missing references) BuffDef obj = ScriptableObject.CreateInstance(); ((Object)obj).name = name; obj.isDebuff = debuff; obj.canStack = false; obj.buffColor = color; obj.iconSprite = Graybox.Icon(color); return obj; } } public sealed class TimpanistController : MonoBehaviour { private sealed class PendingBeat { public HealthComponent target; public Vector3 point; public float at; public bool crit; public HashSet hit; } public CharacterBody Body; public EntityStateMachine Weapon; public EntityStateMachine Cavalry; public EntityStateMachine BodyMachine; public Tuning LeftMode = Tuning.Mid; public Tuning RightMode = Tuning.Mid; public byte VisualMask; public float LeftFlash = -100f; public float RightFlash = -100f; public float TuneFlash = -100f; public float StrokeSpeed = 1f; public float ImpactSoundAt = -100f; public float RollClock; public float NextEffectTick; public float ChargeFlash = -100f; public float GrandFlash = -100f; public bool LastTuneRight; public bool NextRight; public bool PrimaryPressed; public int Cast; public string LastCancellation = ""; private bool oldPrimary; private bool focus = true; private float chargeUntil; private readonly List pending = new List(); public bool VisualRolling => VisualMask != 0; private void Awake() { Body = ((Component)this).GetComponent(); EntityStateMachine[] components = ((Component)this).GetComponents(); foreach (EntityStateMachine val in components) { if (val.customName == "Weapon") { Weapon = val; } if (val.customName == "Cavalry") { Cavalry = val; } if (val.customName == "Body") { BodyMachine = val; } } } private void Start() { CharacterBody body = Body; body.OnBodyDeath = (Action)Delegate.Combine(body.OnBodyDeath, new Action(Died)); if (Plugin.Diagnostics.Value) { ((Component)this).gameObject.AddComponent(); } } public Tuning Pitch(bool right) { if (!right) { return LeftMode; } return RightMode; } private void Died(CharacterBody b) { PresentationRagdoll.Release(b); pending.Clear(); CancelRoll("death"); CancelCharge(); } public int NextCast() { return ++Cast; } public bool InputAllowed() { if (!Object.op_Implicit((Object)(object)Body) || Body.allSkillsDisabled || !Object.op_Implicit((Object)(object)Body.healthComponent) || !Body.healthComponent.alive || !Object.op_Implicit((Object)(object)BodyMachine) || !(BodyMachine.state is TimpanistMain)) { return false; } if (Body.isPlayerControlled) { foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList) { if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)Body) { return focus && !readOnlyLocalUsers.isUIFocused; } } } return true; } private void OnApplicationFocus(bool value) { focus = value; if (!value && Object.op_Implicit((Object)(object)Body) && Body.hasEffectiveAuthority) { CancelRoll("application focus"); CancelCharge(); } } private void Update() { if (Object.op_Implicit((Object)(object)Body) && Body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)Body.inputBank)) { bool down = Body.inputBank.skill1.down; PrimaryPressed |= down && !oldPrimary; oldPrimary = down; if (!InputAllowed()) { PrimaryPressed = false; } } } private void FixedUpdate() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Body) || !Object.op_Implicit((Object)(object)Body.skillLocator)) { return; } if (NetworkServer.active && chargeUntil > 0f && Time.fixedTime >= chargeUntil) { EndChargePoise(); } if (!InputAllowed()) { CancelRoll("body interruption"); CancelCharge(); } if ((Object)(object)Body.skillLocator.utility.skillDef != (Object)(object)Content.Charge) { CancelCharge(); } if (!NetworkServer.active) { return; } if (!Body.healthComponent.alive) { pending.Clear(); return; } for (int num = pending.Count - 1; num >= 0; num--) { PendingBeat pendingBeat = pending[num]; if (!(Time.fixedTime < pendingBeat.at)) { pending.RemoveAt(num); Vector3 origin = ((Object.op_Implicit((Object)(object)pendingBeat.target) && Object.op_Implicit((Object)(object)pendingBeat.target.body)) ? pendingBeat.target.body.corePosition : pendingBeat.point); Combat.Area(Body, origin, Vector3.forward, 5f, 180f, 1.8f, 0.35f, (DamageSource)4, pendingBeat.crit, stun: false, pendingBeat.hit, 100f); ImpactVisual.Emit(Body, origin, Vector3.forward, 5f, ImpactKind.Afterbeat); } } } public void QueueAfterbeat(HealthComponent target, Vector3 point, bool crit, HashSet shared) { //IL_002a: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && pending.Count < 64) { pending.Add(new PendingBeat { target = target, point = point, crit = crit, at = Time.fixedTime + 0.32f, hit = shared }); ImpactVisual.Emit(Body, point, Vector3.forward, 1.5f, ImpactKind.ChargeContact); } } public void GrantPoise(float duration, bool charge = false) { if (NetworkServer.active) { chargeUntil = Time.fixedTime + duration; if (!Body.HasBuff(Content.Poise)) { Body.AddBuff(Content.Poise); } } } public void EndChargePoise() { if (NetworkServer.active && Object.op_Implicit((Object)(object)Body) && Object.op_Implicit((Object)(object)Content.Poise) && Body.HasBuff(Content.Poise)) { Body.RemoveBuff(Content.Poise); } chargeUntil = 0f; } public void CancelCharge() { if (Object.op_Implicit((Object)(object)Cavalry) && Cavalry.state is ChargeState && Body.hasEffectiveAuthority) { Cavalry.SetNextStateToMain(); } } public void CancelRoll(string why) { LastCancellation = why; if (Object.op_Implicit((Object)(object)Body) && Body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)Weapon) && Weapon.state is RollState) { Weapon.SetNextStateToMain(); } VisualMask = 0; } public void Trace(string evt, string action, GenericSkill slot, float q, float coefficient, float proc, bool crit, int target = 0) { if (Plugin.Diagnostics.Value) { Plugin.Log($"TIMP event={evt} action={action} damage={coefficient:R} proc={proc:R} target={target}"); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)Body)) { CharacterBody body = Body; body.OnBodyDeath = (Action)Delegate.Remove(body.OnBodyDeath, new Action(Died)); } pending.Clear(); EndChargePoise(); } } public enum Tuning : byte { Low, Mid, High } public enum ActionKind : byte { None, Left, Right, Roll, Stop, TuneLeft, TuneRight } public static class Rules { public static float Speed(float a) { return Math.Max(0.1f, a); } public static float StrokeTime(float a) { return Math.Max(0.1f, 0.42f / Speed(a)); } public static Tuning Next(Tuning value) { return (Tuning)((int)(value + 1) % 3); } public static float Range(Tuning value) { return value switch { Tuning.Mid => 22, Tuning.Low => 10, _ => 40, }; } public static float Angle(Tuning value) { return value switch { Tuning.Mid => 40, Tuning.Low => 100, _ => 12, }; } public static float Damage(Tuning value) { return value switch { Tuning.Mid => 2.4f, Tuning.Low => 1.8f, _ => 3.2f, }; } public static bool Resonant(Tuning left, Tuning right) { if (left != Tuning.Mid || right != Tuning.Low) { if (left == Tuning.High) { return right == Tuning.Mid; } return false; } return true; } public static float RollBonus(byte mask, Tuning left, Tuning right) { if (mask != 3 || !Resonant(left, right)) { return 1f; } return 1.2f; } public static string Note(bool right, Tuning pitch) { if (!right) { return pitch switch { Tuning.Mid => "B", Tuning.Low => "G", _ => "D", }; } return pitch switch { Tuning.Mid => "D", Tuning.Low => "B", _ => "F", }; } public static float Contribution(byte mask, int side) { if ((mask & (1 << side)) != 0) { if (mask != 3) { return 1f; } return 0.5f; } return 0f; } } public static class CavalryRules { public const float StrikeDamage = 4f; public const float StrikeRange = 22f; public const float StrikeAngle = 38f; public const float RollDuration = 2f; public const float RollTick = 0.2f; public const float RollRange = 14f; public const float RollAngle = 50f; public const float ChargeDuration = 1f; public const float ChargeDamage = 3.5f; public const float AfterbeatDamage = 1.8f; public const float AfterbeatDelay = 0.32f; public const float AfterbeatRadius = 5f; public const float GrandDamage = 9f; public const float GrandRange = 25f; public const float GrandAngle = 55f; public static float StrikeDuration(float speed) { return Math.Max(0.16f, 0.62f / Rules.Speed(speed)); } public static float ContactTime(float speed) { return 0.12f / Rules.Speed(speed); } public static float ChargeSpeed(float walk, float age) { return Math.Max(1f, walk) * (2.5f + 0.5f * Math.Min(1f, Math.Max(0f, age) / 0.15f)); } public static float RollDamage(float speed) { return 0.24f * Rules.Speed(speed); } public static bool ChargeCancel(bool pressed, float age) { if (pressed) { return age >= 0.1f; } return false; } } public sealed class CustomPcmOutput : IDisposable { private sealed class LoopVoice { public Sample Sample; public Sample Wanted; public int Position; public float Envelope; public float Level; } private sealed class ClientState { public bool Active = true; public bool Audible; public bool PairWarning; public float TargetL; public float TargetR; public float CurrentL; public float CurrentR; public readonly int[,] Variant = new int[2, 3]; public readonly LoopVoice[] Loops = new LoopVoice[3] { new LoopVoice(), new LoopVoice(), new LoopVoice() }; } private sealed class StrikeVoice { public ClientState Owner; public Sample Sample; public int Position; public float Envelope; public float Level; public bool Stopping; } private sealed class Sample { public readonly float[] Data; public Sample(float[] data) { Data = data; } } private sealed class StrikeSet { public readonly Sample[] Variants; public StrikeSet(Sample[] variants) { Variants = variants; } } private sealed class Library { public readonly StrikeSet[,] Strikes = new StrikeSet[2, 3]; public readonly Sample[,] Rolls = new Sample[2, 3]; public readonly Sample[,] Pairs = new Sample[3, 3]; public long SourceBytes; public int DecodedSourceFrames; public int StrikeCount; public int IndividualRollCount; public int PairCount; private static readonly string[] tuning = new string[3] { "low", "mid", "high" }; public static Library Load(string directory) { Library library = new Library(); long sourceBytes = 0L; int decodedFrames = 0; int num = 0; int num2 = 0; for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { string text = ((i == 0) ? "left" : "right") + "-" + tuning[j]; library.Strikes[i, j] = new StrikeSet(new Sample[1] { Read(Path.Combine(directory, text + "-strike.wav"), loop: false, ref sourceBytes, ref decodedFrames) }); library.Rolls[i, j] = Read(Path.Combine(directory, text + "-roll.wav"), loop: true, ref sourceBytes, ref decodedFrames); } } for (int k = 0; k < 2; k++) { for (int l = 0; l < 3; l++) { string text2 = ((k == 0) ? "left" : "right") + "-" + tuning[l]; List list = new List(library.Strikes[k, l].Variants); for (int m = 2; m <= 6; m++) { Sample sample = Optional(Path.Combine(directory, text2 + "-strike-" + m.ToString("00") + ".wav"), loop: false, ref sourceBytes, ref decodedFrames); if (sample != null) { list.Add(sample); } } library.Strikes[k, l] = new StrikeSet(list.ToArray()); num2 += list.Count; } } for (int n = 0; n < 3; n++) { for (int num3 = 0; num3 < 3; num3++) { library.Pairs[n, num3] = Optional(Path.Combine(directory, "split-" + n + "-" + num3 + "-roll.wav"), loop: true, ref sourceBytes, ref decodedFrames); if (library.Pairs[n, num3] != null) { num++; } } } library.SourceBytes = sourceBytes; library.DecodedSourceFrames = decodedFrames; library.StrikeCount = num2; library.IndividualRollCount = 6; library.PairCount = num; Message("Loaded timpani PCM library once: " + num2 + " strike takes, 6 individual rolls, " + num + " paired rolls; " + sourceBytes + " WAV bytes."); return library; } private static Sample Optional(string path, bool loop, ref long sourceBytes, ref int decodedFrames) { if (!File.Exists(path)) { return null; } long num = sourceBytes; int num2 = decodedFrames; try { return Read(path, loop, ref sourceBytes, ref decodedFrames); } catch (Exception ex) { sourceBytes = num; decodedFrames = num2; Message("Optional timpani WAV skipped: " + Path.GetFileName(path) + ": " + ex.Message); return null; } } private static Sample Read(string path, bool loop, ref long sourceBytes, ref int decodedFrames) { FileInfo fileInfo = new FileInfo(path); if (!fileInfo.Exists) { throw new FileNotFoundException("Required timpani WAV missing", path); } if (fileInfo.Length < 44 || fileInfo.Length > 5242880 || (sourceBytes += fileInfo.Length) > 100663296) { throw new InvalidDataException("Audio library/file byte limit"); } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; byte[] array = null; using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(path))) { if (new string(binaryReader.ReadChars(4)) != "RIFF") { throw new InvalidDataException("Expected RIFF WAV: " + path); } uint num5 = binaryReader.ReadUInt32(); if (new string(binaryReader.ReadChars(4)) != "WAVE" || (long)num5 + 8L > binaryReader.BaseStream.Length) { throw new InvalidDataException("Invalid WAVE length"); } long num6 = (long)num5 + 8L; while (binaryReader.BaseStream.Position + 8 <= num6) { string text = new string(binaryReader.ReadChars(4)); uint num7 = binaryReader.ReadUInt32(); long num8 = binaryReader.BaseStream.Position + num7; if (num8 > num6 || num7 > 5242880) { throw new InvalidDataException("Invalid WAVE chunk"); } if (text == "fmt ") { if (num7 < 16) { throw new InvalidDataException("Short WAVE format"); } num4 = binaryReader.ReadUInt16(); num2 = binaryReader.ReadUInt16(); num = binaryReader.ReadInt32(); binaryReader.ReadInt32(); ushort num9 = binaryReader.ReadUInt16(); num3 = binaryReader.ReadUInt16(); if (num9 != num2 * 2) { throw new InvalidDataException("WAVE PCM block alignment"); } } else if (text == "data") { if (array != null) { throw new InvalidDataException("Multiple WAVE data chunks unsupported"); } array = binaryReader.ReadBytes((int)num7); if (array.Length != (int)num7) { throw new EndOfStreamException(); } } binaryReader.BaseStream.Position = num8 + (num7 & 1); } } if (num4 != 1 || (num2 != 1 && num2 != 2) || num3 != 16 || num < 8000 || num > 96000 || array == null || array.Length % (num2 * 2) != 0) { throw new InvalidDataException("Expected mono/stereo PCM16 WAV, 8-96kHz: " + path); } int num10 = array.Length / (num2 * 2); int num11 = (int)Math.Round((double)num10 * 48000.0 / (double)num); if (num11 < 2400 || num11 > 1152000 || (decodedFrames += num11) > 24000000) { throw new InvalidDataException("Audio duration/decoded-memory limit"); } float[] array2 = new float[num11]; for (int i = 0; i < num11; i++) { double num12 = (double)i * (double)num / 48000.0; int num13 = Math.Min(num10 - 1, (int)num12); int num14 = Math.Min(num10 - 1, num13 + 1); float num15 = (float)(num12 - (double)num13); float num16 = 0f; float num17 = 0f; for (int j = 0; j < num2; j++) { num16 += (float)BitConverter.ToInt16(array, (num13 * num2 + j) * 2) / 32768f; num17 += (float)BitConverter.ToInt16(array, (num14 * num2 + j) * 2) / 32768f; } array2[i] = (num16 + (num17 - num16) * num15) / (float)num2; } if (loop) { int num18 = Math.Min(240, num11 / 8); float[] array3 = new float[num11 - num18]; for (int k = 0; k < array3.Length; k++) { float num19 = ((k < num18) ? ((float)(0.5 - 0.5 * Math.Cos(Math.PI * (double)(k + 1) / (double)num18))) : 1f); array3[k] = ((k < num18) ? (array2[num11 - num18 + k] * (1f - num19) + array2[k] * num19) : array2[k]); } array2 = array3; } return new Sample(array2); } } private sealed class Engine { public readonly object Gate = new object(); public readonly Library Bank; public readonly StrikeVoice[] Strikes = new StrikeVoice[16]; private readonly ClientState[] clients = new ClientState[8]; private readonly NativeBuffer[] buffers = new NativeBuffer[3]; private readonly short[] output = new short[960]; public volatile bool Ready; public volatile bool Failed; public volatile bool Closing; public int ClientCount; public int CloseAfter; private Thread worker; private IntPtr device; public Engine(Library bank) { Bank = bank; for (int i = 0; i < Strikes.Length; i++) { Strikes[i] = new StrikeVoice(); } } public ClientState Add() { lock (Gate) { if (Closing || Failed) { return null; } for (int i = 0; i < clients.Length; i++) { if (clients[i] == null) { ClientState clientState = new ClientState(); clients[i] = clientState; ClientCount++; return clientState; } } return null; } } public void Start() { worker = new Thread(Work) { IsBackground = true, Name = "Timpanist PCM output" }; worker.Start(); } private void Work() { try { WaveFormat format = new WaveFormat { Format = 1, Channels = 2, SamplesPerSecond = 48000u, BytesPerSecond = 192000u, BlockAlign = 4, Bits = 16, ExtraSize = 0 }; Check(Native.waveOutOpen(out var intPtr, uint.MaxValue, ref format, UIntPtr.Zero, UIntPtr.Zero, 0u), "open"); device = intPtr; for (int i = 0; i < buffers.Length; i++) { buffers[i] = new NativeBuffer(); buffers[i].Prepare(device); } Ready = true; Message("Custom timpani WinMM PCM ready: 48 kHz stereo, three 10 ms buffers; owned volume/pan, independent of Wwise SFX bus."); int num = 0; while (true) { lock (Gate) { if (ClientCount == 0 && Environment.TickCount - CloseAfter >= 60) { Closing = true; break; } } NativeBuffer nativeBuffer = buffers[num]; if (!nativeBuffer.Submitted || nativeBuffer.Done) { lock (Gate) { Render(); } Marshal.Copy(output, 0, nativeBuffer.Data, output.Length); Check(Native.waveOutWrite(device, nativeBuffer.Header, (uint)NativeBuffer.HeaderSize), "write"); nativeBuffer.Submitted = true; num = (num + 1) % buffers.Length; } else { Thread.Sleep(2); } } } catch (Exception ex) { Failed = true; Closing = true; Message("Custom timpani PCM stopped: " + ex.GetType().Name + ": " + ex.Message); } finally { Ready = false; Closing = true; int num2 = 0; while (!Cleanup()) { if (num2 == 0) { Message("PCM cleanup retained native resources for retry; new output waits for successful cleanup."); } num2 = Math.Min(19, num2 + 1); Thread.Sleep(100 + num2 * 100); } lock (global) { if (shared == this) { shared = null; } } Message("Custom timpani PCM device and all native buffers closed."); } } private bool Cleanup() { NativeBuffer[] array; if (device != IntPtr.Zero) { uint num; try { num = Native.waveOutReset(device); } catch { return false; } if (num != 0) { return false; } array = buffers; foreach (NativeBuffer nativeBuffer in array) { if (nativeBuffer != null && !nativeBuffer.Unprepare(device)) { return false; } } try { if (Native.waveOutClose(device) != 0) { return false; } } catch { return false; } device = IntPtr.Zero; } array = buffers; for (int i = 0; i < array.Length; i++) { array[i]?.Free(); } return true; } private static float Move(float x, float target, float step) { if (!(x < target)) { return Math.Max(target, x - step); } return Math.Min(target, x + step); } private void Render() { for (int i = 0; i < 480; i++) { float num = 0f; float num2 = 0f; ClientState[] array = clients; foreach (ClientState clientState in array) { if (clientState == null) { continue; } clientState.CurrentL = Move(clientState.CurrentL, clientState.TargetL, 0.0013888889f); clientState.CurrentR = Move(clientState.CurrentR, clientState.TargetR, 0.0013888889f); LoopVoice[] loops = clientState.Loops; foreach (LoopVoice loopVoice in loops) { if (loopVoice.Sample == null && loopVoice.Wanted != null) { loopVoice.Sample = loopVoice.Wanted; loopVoice.Position = 0; } loopVoice.Envelope = Move(loopVoice.Envelope, (loopVoice.Sample != null && loopVoice.Sample == loopVoice.Wanted) ? loopVoice.Level : 0f, 0.0010416667f); if (loopVoice.Sample != null) { float num3 = loopVoice.Sample.Data[loopVoice.Position++] * loopVoice.Envelope; if (loopVoice.Position >= loopVoice.Sample.Data.Length) { loopVoice.Position = 0; } num += num3 * clientState.CurrentL; num2 += num3 * clientState.CurrentR; if (loopVoice.Envelope <= 0f && loopVoice.Sample != loopVoice.Wanted) { loopVoice.Sample = null; loopVoice.Position = 0; } } } } StrikeVoice[] strikes = Strikes; foreach (StrikeVoice strikeVoice in strikes) { ClientState owner = strikeVoice.Owner; if (owner != null) { strikeVoice.Envelope = Move(strikeVoice.Envelope, (!strikeVoice.Stopping) ? 1 : 0, 1f / (48000f * (strikeVoice.Stopping ? 0.01f : 0.002f))); int num4 = strikeVoice.Sample.Data.Length - strikeVoice.Position; float num5 = Math.Min(1f, (float)num4 / 240f); float num6 = strikeVoice.Sample.Data[strikeVoice.Position++] * strikeVoice.Level * strikeVoice.Envelope * num5; num += num6 * owner.CurrentL; num2 += num6 * owner.CurrentR; if (strikeVoice.Position >= strikeVoice.Sample.Data.Length || (strikeVoice.Stopping && strikeVoice.Envelope <= 0f)) { strikeVoice.Owner = null; strikeVoice.Sample = null; } } } output[i * 2] = (short)(Math.Tanh(num * 0.75f) * 32760.0); output[i * 2 + 1] = (short)(Math.Tanh(num2 * 0.75f) * 32760.0); } for (int l = 0; l < clients.Length; l++) { ClientState clientState2 = clients[l]; if (clientState2 == null || clientState2.Active || clientState2.CurrentL > 0f || clientState2.CurrentR > 0f) { continue; } bool flag = false; LoopVoice[] loops = clientState2.Loops; for (int j = 0; j < loops.Length; j++) { if (loops[j].Sample != null) { flag = true; break; } } if (!flag) { clients[l] = null; } } } private static void Check(uint result, string operation) { if (result != 0) { throw new InvalidOperationException("waveOut " + operation + " MMRESULT=" + result); } } } private struct WaveHeader { public IntPtr Data; public uint Length; public uint Recorded; public UIntPtr User; public uint Flags; public uint Loops; public IntPtr Next; public UIntPtr Reserved; } [StructLayout(LayoutKind.Sequential, Pack = 2)] private struct WaveFormat { public ushort Format; public ushort Channels; public uint SamplesPerSecond; public uint BytesPerSecond; public ushort BlockAlign; public ushort Bits; public ushort ExtraSize; } private sealed class NativeBuffer { public static readonly int HeaderSize = Marshal.SizeOf(typeof(WaveHeader)); private static readonly int FlagsOffset = (int)Marshal.OffsetOf(typeof(WaveHeader), "Flags"); public IntPtr Header; public IntPtr Data; public bool Submitted; private bool prepared; public bool Done => (Marshal.ReadInt32(Header, FlagsOffset) & 1) != 0; public void Prepare(IntPtr device) { Data = Marshal.AllocHGlobal(1920); Header = Marshal.AllocHGlobal(HeaderSize); Marshal.StructureToPtr(new WaveHeader { Data = Data, Length = 1920u }, Header, fDeleteOld: false); uint num = Native.waveOutPrepareHeader(device, Header, (uint)HeaderSize); if (num != 0) { throw new InvalidOperationException("waveOut prepare MMRESULT=" + num); } prepared = true; } public bool Unprepare(IntPtr device) { if (!prepared) { return true; } uint num; try { num = Native.waveOutUnprepareHeader(device, Header, (uint)HeaderSize); } catch { return false; } if (num != 0) { return false; } prepared = false; return true; } public void Free() { if (Header != IntPtr.Zero) { Marshal.FreeHGlobal(Header); Header = IntPtr.Zero; } if (Data != IntPtr.Zero) { Marshal.FreeHGlobal(Data); Data = IntPtr.Zero; } } } private static class Native { [DllImport("winmm.dll", ExactSpelling = true)] internal static extern uint waveOutOpen(out IntPtr output, uint device, ref WaveFormat format, UIntPtr callback, UIntPtr instance, uint flags); [DllImport("winmm.dll", ExactSpelling = true)] internal static extern uint waveOutPrepareHeader(IntPtr output, IntPtr header, uint bytes); [DllImport("winmm.dll", ExactSpelling = true)] internal static extern uint waveOutWrite(IntPtr output, IntPtr header, uint bytes); [DllImport("winmm.dll", ExactSpelling = true)] internal static extern uint waveOutReset(IntPtr output); [DllImport("winmm.dll", ExactSpelling = true)] internal static extern uint waveOutUnprepareHeader(IntPtr output, IntPtr header, uint bytes); [DllImport("winmm.dll", ExactSpelling = true)] internal static extern uint waveOutClose(IntPtr output); } private const int Rate = 48000; private const int Frames = 480; private const int BufferCount = 3; private const int MaxClients = 8; private const int MaxStrikes = 16; private const int MaxFileBytes = 5242880; private const int MaxLibraryBytes = 100663296; private const int MaxDecodedFrames = 24000000; private const int MaxSampleFrames = 1152000; private static readonly object global = new object(); private static readonly object messageGate = new object(); private static readonly Queue messages = new Queue(); private static Library library; private static Engine shared; private static bool unsupportedReported; private static long nextLibraryTry; private static string lastLibraryError; private readonly Engine engine; private readonly ClientState state; private readonly Action logger; private bool disposed; public bool Available { get { if (!disposed && engine.Ready) { return !engine.Failed; } return false; } } private CustomPcmOutput(Engine e, ClientState s, Action log) { engine = e; state = s; logger = log; } public static CustomPcmOutput TryCreate(string directory, Action logger) { PumpMessages(logger); if (Environment.OSVersion.Platform != PlatformID.Win32NT) { if (!unsupportedReported) { unsupportedReported = true; Message("Custom timpani PCM requires Windows; no native explosion fallback."); PumpMessages(logger); } return null; } lock (global) { try { if (library == null) { if (DateTime.UtcNow.Ticks < nextLibraryTry) { return null; } try { library = Library.Load(directory); lastLibraryError = null; } catch (Exception ex) { nextLibraryTry = DateTime.UtcNow.AddSeconds(5.0).Ticks; string text = ex.GetType().Name + ": " + ex.Message; if (text != lastLibraryError) { Message("Custom timpani WAV library unavailable: " + text); lastLibraryError = text; } return null; } } if (shared != null && (shared.Closing || shared.Failed)) { return null; } bool flag = shared == null; if (flag) { shared = new Engine(library); } ClientState clientState = shared.Add(); if (clientState == null) { Message("Custom timpani client limit reached (8); this body remains silent."); return null; } CustomPcmOutput result = new CustomPcmOutput(shared, clientState, logger); if (flag) { try { shared.Start(); } catch { shared = null; throw; } } return result; } catch (Exception ex2) { Message("Custom timpani audio unavailable: " + ex2.GetType().Name + ": " + ex2.Message); return null; } } } public void PumpLogs() { PumpMessages(logger); } public static void PumpMessages(Action logger) { if (logger == null) { return; } for (int i = 0; i < 16; i++) { string obj; lock (messageGate) { if (messages.Count == 0) { break; } obj = messages.Dequeue(); } try { logger(obj); } catch { } } } private static void Message(string text) { lock (messageGate) { if (messages.Count < 32) { messages.Enqueue(text); } } } private static float Clamp(float x, float a, float b) { if (!float.IsNaN(x) && !float.IsInfinity(x)) { return Math.Max(a, Math.Min(b, x)); } return a; } public void SetMix(float gain, float pan, bool audible, bool leftRoll, int leftTuning, bool rightRoll, int rightTuning, float rollGain) { if (disposed) { return; } lock (engine.Gate) { if (!state.Active) { return; } state.Audible = audible; gain = (audible ? Clamp(gain, 0f, 1f) : 0f); pan = Clamp(pan, -1f, 1f); state.TargetL = gain * (float)Math.Sqrt((double)(1f - pan) * 0.5); state.TargetR = gain * (float)Math.Sqrt((double)(1f + pan) * 0.5); int num = Math.Max(0, Math.Min(2, leftTuning)); int num2 = Math.Max(0, Math.Min(2, rightTuning)); Sample sample = ((leftRoll && rightRoll) ? engine.Bank.Pairs[num, num2] : null); if (audible && leftRoll && rightRoll && sample == null && !state.PairWarning) { state.PairWarning = true; Message("Paired roll WAV missing; mixing the two individual continuous roll recordings."); } state.Loops[0].Wanted = ((audible && leftRoll && sample == null) ? engine.Bank.Rolls[0, num] : null); state.Loops[1].Wanted = ((audible && rightRoll && sample == null) ? engine.Bank.Rolls[1, num2] : null); state.Loops[2].Wanted = (audible ? sample : null); LoopVoice[] loops = state.Loops; for (int i = 0; i < loops.Length; i++) { loops[i].Level = Clamp(rollGain, 0f, 1f); } if (audible) { return; } StrikeVoice[] strikes = engine.Strikes; foreach (StrikeVoice strikeVoice in strikes) { if (strikeVoice.Owner == state) { strikeVoice.Stopping = true; } } } } public void Strike(bool right, int tuning, float gain) { if (disposed) { return; } lock (engine.Gate) { if (!state.Active || !state.Audible || engine.Failed || engine.Closing) { return; } StrikeVoice strikeVoice = null; StrikeVoice[] strikes = engine.Strikes; foreach (StrikeVoice strikeVoice2 in strikes) { if (strikeVoice2.Owner == null) { strikeVoice = strikeVoice2; break; } } if (strikeVoice != null) { int num = (right ? 1 : 0); int num2 = Math.Max(0, Math.Min(2, tuning)); Sample[] variants = engine.Bank.Strikes[num, num2].Variants; int num3 = state.Variant[num, num2]; state.Variant[num, num2] = (num3 + 1) % variants.Length; strikeVoice.Owner = state; strikeVoice.Sample = variants[num3]; strikeVoice.Position = 0; strikeVoice.Level = Clamp(gain, 0f, 1f); strikeVoice.Envelope = 0f; strikeVoice.Stopping = false; } } } public void Dispose() { if (disposed) { return; } disposed = true; lock (engine.Gate) { if (!state.Active) { return; } state.Active = false; state.Audible = false; state.TargetL = (state.TargetR = 0f); LoopVoice[] loops = state.Loops; for (int i = 0; i < loops.Length; i++) { loops[i].Wanted = null; } StrikeVoice[] strikes = engine.Strikes; foreach (StrikeVoice strikeVoice in strikes) { if (strikeVoice.Owner == state) { strikeVoice.Stopping = true; } } engine.ClientCount--; if (engine.ClientCount == 0) { engine.CloseAfter = Environment.TickCount; } } } } public sealed class DevelopmentHarness : MonoBehaviour { [ConCommand(/*Could not decode attribute arguments.*/)] private static void Probe(ConCommandArgs args) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody; TimpanistController timpanistController = (Object.op_Implicit((Object)(object)senderBody) ? ((Component)senderBody).GetComponent() : null); if (!Object.op_Implicit((Object)(object)timpanistController)) { Plugin.Log("No Timpanist sender body"); return; } Plugin.Log($"TIMP 0.3.2 authority={senderBody.hasEffectiveAuthority} secondaryStock={senderBody.skillLocator.secondary.stock} rollMask={timpanistController.VisualMask} bodyState={((object)timpanistController.BodyMachine.state).GetType().Name} grounded={senderBody.characterMotor.isGrounded} position={((Component)senderBody).transform.position} foot={senderBody.footPosition}"); } } public static class DisplayRules { public static ItemDisplayRuleSet Mounted(ItemDisplayRuleSet source) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRuleSet val = ScriptableObject.CreateInstance(); ((Object)val).name = "TimpanistMountedDisplayRules"; if (!Object.op_Implicit((Object)(object)source) || source.keyAssetRuleGroups == null) { val.keyAssetRuleGroups = Array.Empty(); return val; } KeyAssetRuleGroup[] array = (KeyAssetRuleGroup[])source.keyAssetRuleGroups.Clone(); for (int i = 0; i < array.Length; i++) { DisplayRuleGroup displayRuleGroup = array[i].displayRuleGroup; if (displayRuleGroup.rules != null) { ItemDisplayRule[] array2 = (ItemDisplayRule[])displayRuleGroup.rules.Clone(); for (int j = 0; j < array2.Length; j++) { string text = (array2[j].childName ?? "").ToLowerInvariant(); bool flag = text.EndsWith("l") || text.Contains("left"); array2[j].childName = (text.Contains("head") ? "Head" : (text.Contains("chest") ? "Chest" : (text.Contains("neck") ? "Neck" : ((!text.Contains("upperarm") && !text.Contains("shoulder")) ? ((!text.Contains("arm") && !text.Contains("hand")) ? ((!text.Contains("thigh") && !text.Contains("calf") && !text.Contains("foot")) ? (text.Contains("pelvis") ? (flag ? "HipL" : "HipR") : "SaddleBack") : (flag ? "HorseFlankL" : "HorseFlankR")) : (flag ? "ForearmL" : "ForearmR")) : (flag ? "ShoulderL" : "ShoulderR"))))); array2[j].localPos = Vector3.ClampMagnitude(array2[j].localPos, 0.23f); } displayRuleGroup.rules = array2; array[i].displayRuleGroup = displayRuleGroup; } } val.keyAssetRuleGroups = array; return val; } } public sealed class DrumSurfaceVisual : MonoBehaviour { private CharacterModel model; private TimpanistController c; private readonly Material[] materials = (Material[])(object)new Material[2]; private readonly LineRenderer[] rings = (LineRenderer[])(object)new LineRenderer[2]; private readonly TrailRenderer[] trails = (TrailRenderer[])(object)new TrailRenderer[2]; private void Start() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) model = ((Component)this).GetComponentInParent(); if (!Object.op_Implicit((Object)(object)PressureVisual.Template)) { return; } Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(); for (int i = 0; i < 2; i++) { materials[i] = PressureVisual.CreateMaterial(PressureVisual.ColorFor((i != 0) ? Tuning.High : Tuning.Low)); string text = ((i == 0) ? "L" : "R"); Transform val = null; Transform val2 = null; Transform[] array = componentsInChildren; foreach (Transform val3 in array) { if (((Object)val3).name == "Drum" + text) { val = val3; } if (((Object)val3).name == "Hand" + text) { val2 = val3; } } if (Object.op_Implicit((Object)(object)val)) { GameObject val4 = new GameObject("PitchRing" + text); val4.transform.SetParent(val, false); val4.transform.localPosition = Vector3.up * 0.012f; LineRenderer val5 = val4.AddComponent(); ((Renderer)val5).sharedMaterial = materials[i]; val5.useWorldSpace = false; val5.positionCount = 33; val5.widthMultiplier = 0.018f; float num = ((i == 0) ? 0.342f : 0.305f); for (int k = 0; k < 33; k++) { float num2 = (float)k * (float)Math.PI * 2f / 32f; val5.SetPosition(k, new Vector3(Mathf.Cos(num2) * num, 0f, Mathf.Sin(num2) * num)); } rings[i] = val5; } if (Object.op_Implicit((Object)(object)val2)) { GameObject val6 = new GameObject("MalletTrail" + text); val6.transform.SetParent(val2, false); val6.transform.localPosition = new Vector3((i == 0) ? (-0.04f) : 0.04f, -0.1f, 0.295f); TrailRenderer val7 = val6.AddComponent(); ((Renderer)val7).sharedMaterial = materials[i]; val7.time = 0.1f; val7.startWidth = 0.028f; val7.endWidth = 0f; val7.minVertexDistance = 0.025f; val7.emitting = false; trails[i] = val7; } } } private void LateUpdate() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)model.body)) { c = ((Component)model.body).GetComponent(); } for (int i = 0; i < 2; i++) { Color val = PressureVisual.ColorFor(Object.op_Implicit((Object)(object)c) ? c.Pitch(i == 1) : ((i != 0) ? Tuning.High : Tuning.Low)); bool flag = Object.op_Implicit((Object)(object)c) && c.Body.healthComponent.alive; float num = (Object.op_Implicit((Object)(object)c) ? Mathf.Clamp01(1f - (Time.time - ((i == 0) ? c.LeftFlash : c.RightFlash)) / 0.35f) : 0f); float num2 = ((flag && (c.VisualMask & (1 << i)) != 0) ? (0.65f + 0.2f * Mathf.Sin(Time.time * 24f)) : (0.12f + num * 0.8f)); val.a = (flag ? num2 : 0.12f); bool flag2 = Object.op_Implicit((Object)(object)c) && Time.time - c.GrandFlash < 0.55f; if (flag2) { val = Color.Lerp(val, Color.white, 0.35f + 0.2f * Mathf.Sin(Time.time * 7f)); } Material val2 = materials[i]; if (Object.op_Implicit((Object)(object)val2)) { if (val2.HasProperty("_Color")) { val2.SetColor("_Color", val); } if (val2.HasProperty("_EmColor")) { val2.SetColor("_EmColor", val); } if (val2.HasProperty("_EmPower")) { val2.SetFloat("_EmPower", flag2 ? 3f : (1f + num * 3f)); } } if (Object.op_Implicit((Object)(object)rings[i])) { LineRenderer obj = rings[i]; Color startColor = (rings[i].endColor = val); obj.startColor = startColor; rings[i].widthMultiplier = 0.035f + num * 0.06f; } if (Object.op_Implicit((Object)(object)trails[i])) { trails[i].emitting = flag && (c.VisualRolling || num > 0.1f); val.a = 0.65f; trails[i].startColor = val; val.a = 0f; trails[i].endColor = val; } } } private void OnDestroy() { Material[] array = materials; foreach (Material val in array) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } } } } public static class Graybox { public static readonly Color Green = Color32.op_Implicit(new Color32((byte)50, (byte)145, (byte)114, byte.MaxValue)); public static readonly Color Copper = Color32.op_Implicit(new Color32((byte)232, (byte)157, (byte)88, byte.MaxValue)); public static readonly Color Ivory = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)238, (byte)200, byte.MaxValue)); public static readonly Color Metal = Color32.op_Implicit(new Color32((byte)142, (byte)173, (byte)186, byte.MaxValue)); public static readonly Color Bay = Color32.op_Implicit(new Color32((byte)124, (byte)78, (byte)51, byte.MaxValue)); public static readonly Color Black = Color32.op_Implicit(new Color32((byte)41, (byte)49, (byte)56, byte.MaxValue)); public static Material Material(Material template, Color color) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) Material val = (Object.op_Implicit((Object)(object)template) ? new Material(template) : new Material(Shader.Find("Standard"))); ((Object)val).name = "TimpanistGraybox_" + ColorUtility.ToHtmlStringRGB(color); if (val.HasProperty("_Color")) { val.SetColor("_Color", color); } if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_NormalTex")) { val.SetTexture("_NormalTex", (Texture)null); } if (val.HasProperty("_EmColor")) { val.SetColor("_EmColor", color * 0.3f); } if (val.HasProperty("_EmTex")) { val.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_EmPower")) { val.SetFloat("_EmPower", 0.4f); } if (val.HasProperty("_SpecularStrength")) { val.SetFloat("_SpecularStrength", 0.3f); } if (val.HasProperty("_NormalStrength")) { val.SetFloat("_NormalStrength", 0f); } return val; } public static Transform Part(Transform parent, string name, PrimitiveType type, Vector3 position, Vector3 scale, Material mat) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive(type); ((Object)obj).name = name; obj.transform.SetParent(parent, false); obj.transform.localPosition = position; obj.transform.localScale = scale; Object.DestroyImmediate((Object)(object)obj.GetComponent()); obj.GetComponent().sharedMaterial = mat; return obj.transform; } public static Sprite Icon(Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(31.5f, 31.5f)); val.SetPixel(j, i, (num > 29f) ? Color.clear : ((num > 23f) ? color : Ivory)); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); } public static void BuildModel(GameObject body, Transform model, Material template) { //IL_0080: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) CharacterModel component = ((Component)model).GetComponent(); Renderer[] componentsInChildren = ((Component)model).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } LODGroup[] componentsInChildren2 = ((Component)model).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } HurtBox[] componentsInChildren3 = ((Component)model).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren3.Length; i++) { ((Component)componentsInChildren3[i]).gameObject.SetActive(false); } model.localPosition = Vector3.zero; model.localScale = Vector3.one; Transform val = Content.Anchor(model, "TimpanistGraybox", Vector3.zero); bool flag = Presentation.TryBuild(val, template); if (!flag) { BuildVisual(val, template); } Renderer[] componentsInChildren4 = ((Component)val).GetComponentsInChildren(true); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren4.Length]; for (int j = 0; j < array.Length; j++) { array[j] = new RendererInfo { renderer = componentsInChildren4[j], defaultMaterial = componentsInChildren4[j].sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, hideOnDeath = true }; } component.baseRendererInfos = array; component.baseLightInfos = Array.Empty(); component.itemDisplayRuleSet = DisplayRules.Mounted(component.itemDisplayRuleSet); HurtBoxGroup component2 = ((Component)model).GetComponent(); Transform obj = Content.Anchor(model, "TimpanistHurtCapsule", new Vector3(0f, 1.1f, 0f)); ((Component)obj).gameObject.layer = LayerIndex.entityPrecise.intVal; CapsuleCollider obj2 = ((Component)obj).gameObject.AddComponent(); obj2.radius = 0.48f; obj2.height = 2.2f; ((Collider)obj2).isTrigger = false; HurtBox val2 = ((Component)obj).gameObject.AddComponent(); val2.healthComponent = body.GetComponent(); val2.isBullseye = true; val2.hurtBoxGroup = component2; val2.indexInGroup = 0; component2.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 }; component2.mainHurtBox = val2; component2.bullseyeCount = 1; SkinDef val3 = ScriptableObject.CreateInstance(); ((Object)val3).name = "RodaniusTimpanistDefault"; val3.nameToken = "TIMPANIST_DEFAULT"; val3.rootObject = ((Component)model).gameObject; val3.icon = Icon(Copper); val3.baseSkins = Array.Empty(); SkinDefParams val4 = ScriptableObject.CreateInstance(); ((Object)val4).name = "RodaniusTimpanistDefaultParams"; val4.rendererInfos = array; val4.gameObjectActivations = Array.Empty(); val4.meshReplacements = Array.Empty(); val4.projectileGhostReplacements = Array.Empty(); val4.minionSkinReplacements = Array.Empty(); val4.lightReplacements = Array.Empty(); val3.skinDefParams = val4; val3.optimizedSkinDefParams = val4; (((Component)model).GetComponent() ?? ((Component)model).gameObject.AddComponent()).skins = (SkinDef[])(object)new SkinDef[1] { val3 }; if (!flag) { ((Component)val).gameObject.AddComponent(); } ChildLocator component3 = ((Component)model).GetComponent(); List list = new List(); Transform[] componentsInChildren5 = ((Component)val).GetComponentsInChildren(); foreach (Transform val5 in componentsInChildren5) { list.Add(new NameTransformPair { name = ((Object)val5).name, transform = val5 }); } typeof(ChildLocator).GetField("transformPairs", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(component3, list.ToArray()); } public static void BuildVisual(Transform root, Material template) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03da: 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_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_0616: 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_0657: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_0a82: Unknown result type (might be due to invalid IL or missing references) //IL_0a6c: Unknown result type (might be due to invalid IL or missing references) //IL_0a56: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_0775: 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_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_081a: Unknown result type (might be due to invalid IL or missing references) //IL_082e: Unknown result type (might be due to invalid IL or missing references) //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08e1: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_090f: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_093a: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) Material mat = Material(template, Bay); Material mat2 = Material(template, Black); Material mat3 = Material(template, Metal); Material mat4 = Material(template, Copper); Material mat5 = Material(template, Ivory); Material mat6 = Material(template, Green); Part(root, "HorseTorso", (PrimitiveType)0, new Vector3(0f, 1.08f, -0.12f), new Vector3(0.61f, 0.72f, 1.55f), mat); Part(root, "HorseNeck", (PrimitiveType)1, new Vector3(0f, 1.38f, 0.66f), new Vector3(0.35f, 0.48f, 0.42f), mat).localRotation = Quaternion.Euler(28f, 0f, 0f); Part(root, "HorseHead", (PrimitiveType)3, new Vector3(0f, 1.72f, 0.99f), new Vector3(0.26f, 0.39f, 0.44f), mat); Part(root, "Muzzle", (PrimitiveType)0, new Vector3(0f, 1.55f, 1.22f), new Vector3(0.25f, 0.23f, 0.37f), mat); Part(root, "HorseFaceArmor", (PrimitiveType)3, new Vector3(0f, 1.82f, 1.1f), new Vector3(0.23f, 0.14f, 0.28f), mat3); for (int i = -1; i <= 1; i += 2) { Part(root, "Ear" + i, (PrimitiveType)1, new Vector3((float)i * 0.105f, 1.98f, 0.88f), new Vector3(0.07f, 0.12f, 0.09f), mat); Part(root, "Eye" + i, (PrimitiveType)0, new Vector3((float)i * 0.135f, 1.77f, 1.02f), Vector3.one * 0.045f, mat2); for (int j = -1; j <= 1; j += 2) { Transform parent = Content.Anchor(root, "HorseLeg" + i + "_" + j, new Vector3((float)i * 0.24f, 1.04f, (float)j * 0.57f - 0.12f)); Part(parent, "Upper", (PrimitiveType)1, new Vector3(0f, -0.25f, 0f), new Vector3(0.14f, 0.25f, 0.17f), mat); Part(parent, "Lower", (PrimitiveType)1, new Vector3(0f, -0.7f, 0.02f), new Vector3(0.1f, 0.24f, 0.11f), mat); Part(parent, "Hoof", (PrimitiveType)3, new Vector3(0f, -0.98f, 0.05f), new Vector3(0.16f, 0.13f, 0.23f), mat2); } } Part(root, "Mane", (PrimitiveType)3, new Vector3(0f, 1.64f, 0.61f), new Vector3(0.11f, 0.48f, 0.15f), mat2); Part(root, "Tail", (PrimitiveType)1, new Vector3(0f, 0.85f, -1.05f), new Vector3(0.12f, 0.45f, 0.13f), mat2).localRotation = Quaternion.Euler(-25f, 0f, 0f); Part(root, "SaddleCloth", (PrimitiveType)3, new Vector3(0f, 1.36f, -0.15f), new Vector3(0.69f, 0.12f, 0.75f), mat6); Part(root, "Saddle", (PrimitiveType)3, new Vector3(0f, 1.45f, -0.15f), new Vector3(0.48f, 0.14f, 0.57f), mat2); Part(root, "RiderPelvis", (PrimitiveType)3, new Vector3(0f, 1.57f, -0.17f), new Vector3(0.34f, 0.2f, 0.3f), mat3); Part(root, "RiderTorso", (PrimitiveType)1, new Vector3(0f, 1.89f, -0.13f), new Vector3(0.4f, 0.24f, 0.28f), mat3); Part(root, "Tabard", (PrimitiveType)3, new Vector3(0f, 1.8f, 0.025f), new Vector3(0.22f, 0.36f, 0.035f), mat6); Part(root, "Helmet", (PrimitiveType)0, new Vector3(0f, 2.24f, -0.08f), new Vector3(0.28f, 0.3f, 0.29f), mat3); Part(root, "Visor", (PrimitiveType)3, new Vector3(0f, 2.26f, 0.065f), new Vector3(0.23f, 0.045f, 0.02f), mat2); Part(root, "HelmetRidge", (PrimitiveType)3, new Vector3(0f, 2.4f, -0.09f), new Vector3(0.035f, 0.055f, 0.24f), mat3); for (int k = -1; k <= 1; k += 2) { string text = ((k < 0) ? "L" : "R"); Part(root, "Thigh" + text, (PrimitiveType)1, new Vector3((float)k * 0.32f, 1.4f, -0.06f), new Vector3(0.16f, 0.24f, 0.2f), mat3).localRotation = Quaternion.Euler(-25f, 0f, (float)(k * 20)); Part(root, "Boot" + text, (PrimitiveType)1, new Vector3((float)k * 0.38f, 1.05f, 0.04f), new Vector3(0.14f, 0.2f, 0.17f), mat3); Part(root, "Cradle" + text, (PrimitiveType)3, new Vector3((float)k * 0.43f, 1.18f, 0.28f), new Vector3(0.22f, 0.1f, 0.48f), mat3); Part(root, "Banner" + text, (PrimitiveType)3, new Vector3((float)k * 0.72f, 1.07f, 0.35f), new Vector3(0.035f, 0.36f, 0.22f), mat6); Transform obj = Content.Anchor(root, "Drum" + text, new Vector3((float)k * 0.55f, 1.47f, 0.35f)); obj.localRotation = Quaternion.Euler(-8f, 0f, 0f); float num = ((k < 0) ? 0.7366f : 0.6604f); Bowl(obj, num, (k < 0) ? 0.42f : 0.38f, mat4); Part(obj, "DrumHead" + text, (PrimitiveType)2, Vector3.zero, new Vector3(num, 0.008f, num), mat5); Part(obj, "Hoop" + text, (PrimitiveType)2, new Vector3(0f, -0.023f, 0f), new Vector3(num + 0.035f, 0.014f, num + 0.035f), mat4); Part(root, "Pedal" + text, (PrimitiveType)3, new Vector3((float)k * 0.4f, 0.9f, 0.15f), new Vector3(0.14f, 0.025f, 0.2f), mat3); Part(root, "Linkage" + text, (PrimitiveType)2, new Vector3((float)k * 0.47f, 1.08f, 0.2f), new Vector3(0.025f, 0.17f, 0.025f), mat3); Transform parent2 = Content.Anchor(root, "Arm" + text, new Vector3((float)k * 0.25f, 2f, -0.12f)); Part(parent2, "UpperArm", (PrimitiveType)1, new Vector3((float)k * 0.08f, -0.13f, 0.055f), new Vector3(0.14f, 0.17f, 0.14f), mat3); Part(parent2, "Forearm", (PrimitiveType)1, new Vector3((float)k * 0.16f, -0.29f, 0.13f), new Vector3(0.12f, 0.13f, 0.12f), mat3); Transform parent3 = Content.Anchor(root, "Hand" + text, new Vector3((float)k * 0.46f, 1.61f, -0.015f)); Part(parent3, "Gauntlet", (PrimitiveType)0, Vector3.zero, new Vector3(0.11f, 0.1f, 0.12f), mat3); Part(parent3, "MalletShaft" + text, (PrimitiveType)2, new Vector3(0f, -0.01f, 0.17f), new Vector3(0.018f, 0.17f, 0.018f), mat4).localRotation = Quaternion.Euler(90f, 0f, 0f); Part(parent3, "Felt" + text, (PrimitiveType)0, new Vector3(0f, -0.01f, 0.35f), Vector3.one * 0.05f, mat5); } string[] array = new string[21] { "Head", "Neck", "Chest", "BackUpper", "BackLower", "ShoulderL", "ShoulderR", "ForearmL", "ForearmR", "HipL", "HipR", "SaddleRearL", "SaddleRearR", "SaddleBack", "HorseChest", "HorseFlankL", "HorseFlankR", "DrumFrameL", "DrumFrameR", "EquipmentMount", "OrbitCenter" }; foreach (string text2 in array) { Content.Anchor(root, text2, (text2 == "Head") ? new Vector3(0f, 2.4f, -0.08f) : ((text2 == "EquipmentMount") ? new Vector3(0f, 1.5f, -0.65f) : new Vector3(0f, 1.65f, -0.2f))); } } private static void Bowl(Transform parent, float diameter, float depth, Material mat) { //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[225]; List list = new List(); for (int i = 0; i <= 8; i++) { float num = (float)i / 8f * (float)Math.PI / 2f; for (int j = 0; j <= 24; j++) { float num2 = (float)j / 24f * (float)Math.PI * 2f; array[i * 25 + j] = new Vector3(Mathf.Sin(num) * Mathf.Cos(num2) * diameter / 2f, (0f - Mathf.Cos(num)) * depth, Mathf.Sin(num) * Mathf.Sin(num2) * diameter / 2f); if (i < 8 && j < 24) { int num3 = i * 25 + j; list.AddRange(new int[6] { num3, num3 + 24 + 1, num3 + 1, num3 + 1, num3 + 24 + 1, num3 + 24 + 2 }); } } } Mesh val = new Mesh { name = "TimpanistBowl" }; val.vertices = array; val.triangles = list.ToArray(); val.RecalculateNormals(); val.RecalculateBounds(); GameObject val2 = new GameObject("CopperBowl"); val2.transform.SetParent(parent, false); val2.AddComponent().sharedMesh = val; ((Renderer)val2.AddComponent()).sharedMaterial = mat; } } public sealed class GrayboxMotion : MonoBehaviour { private TimpanistController c; private Transform left; private Transform right; private Transform[] legs; private float phase; private void Start() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown c = ((Component)this).GetComponentInParent(); left = ((Component)this).transform.Find("HandL"); right = ((Component)this).transform.Find("HandR"); List list = new List(); foreach (Transform item in ((Component)this).transform) { Transform val = item; if (((Object)val).name.StartsWith("HorseLeg")) { list.Add(val); } } legs = list.ToArray(); } private void LateUpdate() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)c)) { CharacterModel componentInParent = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.body)) { c = ((Component)componentInParent.body).GetComponent(); } if (!Object.op_Implicit((Object)(object)c)) { return; } } Vector3 val = Vector3.ProjectOnPlane(c.Body.characterMotor.velocity, Vector3.up); float magnitude = ((Vector3)(ref val)).magnitude; phase += Time.deltaTime * magnitude * 2.2f; for (int i = 0; i < legs.Length; i++) { legs[i].localRotation = Quaternion.Euler(Mathf.Sin(phase + ((i == 0 || i == 3) ? 0f : ((float)Math.PI))) * Mathf.Min(magnitude * 4f, 30f), 0f, 0f); } float num = (c.VisualRolling ? Mathf.Sin(Time.time * 24f) : Mathf.Sin(Mathf.Clamp01((Time.time - c.LeftFlash) / 0.3f) * (float)Math.PI)); float num2 = (c.VisualRolling ? (0f - num) : Mathf.Sin(Mathf.Clamp01((Time.time - c.RightFlash) / 0.3f) * (float)Math.PI)); left.localRotation = Quaternion.Euler(num * 22f, 0f, 0f); right.localRotation = Quaternion.Euler(num2 * 22f, 0f, 0f); } } public enum ImpactKind : uint { ChargeContact, Afterbeat, HeavyContact, Grand, Lance } public static class ImpactVisual { private static GameObject prefab; public static void Build(ContentPack pack) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //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_0082: Expected O, but got Unknown GameObject val = new GameObject("TimpanistEffectTemplates"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); prefab = new GameObject("TimpanistAfterbeatImpact"); prefab.transform.SetParent(val.transform); prefab.AddComponent().applyScale = false; prefab.AddComponent(); prefab.AddComponent(); pack.effectDefs.Add((EffectDef[])(object)new EffectDef[1] { new EffectDef(prefab) { shouldPool = false } }); } public static void Emit(CharacterBody body, Vector3 origin, Vector3 direction, float radius, ImpactKind kind) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (NetworkServer.active && Object.op_Implicit((Object)(object)prefab)) { EffectData val = new EffectData { origin = origin, start = direction, scale = radius, genericUInt = (uint)kind }; val.SetNetworkedObjectReference(((Component)body).gameObject); EffectManager.SpawnEffect(prefab, val, true); } } public static void LocalLance(CharacterBody body, Vector3 direction) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (!Application.isBatchMode && Object.op_Implicit((Object)(object)prefab)) { EffectManager.SpawnEffect(prefab, new EffectData { origin = body.corePosition, start = direction, scale = 3.5f, genericUInt = 4u }, false); } } } public sealed class ImpactEffect : MonoBehaviour { private EffectComponent effect; private Material material; private LineRenderer[] lines; private float age; private bool initialized; private void Awake() { effect = ((Component)this).GetComponent(); } private void Update() { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_037e: 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_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: 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_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) if (Application.isBatchMode) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { if (!Object.op_Implicit((Object)(object)effect) || effect.effectData == null) { return; } EffectData effectData = effect.effectData; ImpactKind genericUInt = (ImpactKind)effectData.genericUInt; float num = genericUInt switch { ImpactKind.Grand => 0.5f, ImpactKind.Lance => 0.18f, ImpactKind.ChargeContact => 0.32f, _ => 0.32f, }; if (!initialized) { initialized = true; material = PressureVisual.CreateMaterial((genericUInt == ImpactKind.Afterbeat || genericUInt == ImpactKind.Grand) ? new Color(1f, 0.78f, 0.24f) : new Color(0.35f, 0.9f, 1f)); if (!Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } lines = (LineRenderer[])(object)new LineRenderer[3]; for (int i = 0; i < 3; i++) { GameObject val = new GameObject("SonicImpactBand"); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent(); ((Renderer)val2).sharedMaterial = material; val2.positionCount = 49; val2.useWorldSpace = true; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; lines[i] = val2; } if (genericUInt == ImpactKind.Afterbeat || genericUInt == ImpactKind.ChargeContact) { GameObject val3 = effectData.ResolveNetworkedObjectReference(); CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent() : null); if (Object.op_Implicit((Object)(object)val4)) { TimpanistController component = ((Component)val4).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Time.time - component.ImpactSoundAt > 0.09f) { component.ImpactSoundAt = Time.time; PresentationAudio.Strike(val4, genericUInt == ImpactKind.Afterbeat, (genericUInt == ImpactKind.Afterbeat) ? 0.8f : 0.6f); } } } } age += Time.deltaTime; float num2 = Mathf.Clamp01(age / num); Vector3 val5 = ((Vector3)(ref effectData.start)).normalized; if (((Vector3)(ref val5)).sqrMagnitude < 0.1f) { val5 = Vector3.forward; } Vector3 val6 = Vector3.Cross(Vector3.up, val5); Vector3 val7 = ((Vector3)(ref val6)).normalized; if (((Vector3)(ref val7)).sqrMagnitude < 0.1f) { val7 = Vector3.right; } val6 = Vector3.Cross(val5, val7); Vector3 normalized = ((Vector3)(ref val6)).normalized; for (int j = 0; j < 3; j++) { LineRenderer val8 = lines[j]; float startWidth = (val8.endWidth = ((genericUInt == ImpactKind.Grand) ? 0.23f : 0.13f) * (1f - num2) + 0.015f); val8.startWidth = startWidth; for (int k = 0; k < 49; k++) { float num4 = (float)k / 48f; float num5 = num4 * (float)Math.PI * 2f; Vector3 val10; switch (genericUInt) { case ImpactKind.Lance: { float num7 = num4 * effectData.scale; float num8 = (1f - num4) * (0.65f + (float)j * 0.3f); val10 = effectData.origin + val5 * num7 + val7 * (Mathf.Cos(num5 + (float)j * 2.1f) * num8) + normalized * (Mathf.Sin(num5 + (float)j * 2.1f) * num8); break; } case ImpactKind.Grand: num5 = Mathf.Lerp(-55f, 55f, num4) * ((float)Math.PI / 180f); val10 = effectData.origin + (val5 * Mathf.Cos(num5) + val7 * Mathf.Sin(num5)) * effectData.scale * Mathf.Clamp01(num2 - (float)j * 0.07f) + normalized * (float)(j - 1) * (0.3f + num2); break; default: { float num6 = effectData.scale * ((genericUInt == ImpactKind.ChargeContact) ? (1f - 0.7f * num2) : Mathf.Sqrt(num2)); Vector3 val9 = (Vector3)(j switch { 1 => Vector3.up, 0 => Vector3.forward, _ => new Vector3(0f, 0.707f, 0.707f), }); val10 = effectData.origin + (Vector3.right * Mathf.Cos(num5) + val9 * Mathf.Sin(num5)) * num6; break; } } val8.SetPosition(k, val10); } } if (material.HasProperty("_EmPower")) { material.SetFloat("_EmPower", 3f * (1f - num2)); } if (age >= num) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } } } internal static class OptionalBinding { private static Func read; internal static void Register() { if (!Chainloader.PluginInfos.TryGetValue("pseudopulse.Rebindables", out var value)) { Plugin.Log("Rebindables absent: hold primary + secondary for Grand Roll. Dedicated binding is optional."); return; } try { Assembly assembly = ((object)value.Instance).GetType().Assembly; Type type = assembly.GetType("Rebindables.ModKeybind", throwOnError: true); Type type2 = assembly.GetType("Rebindables.RebindAPI", throwOnError: true); ConstructorInfo constructorInfo = null; ConstructorInfo[] constructors = type.GetConstructors(); foreach (ConstructorInfo constructorInfo2 in constructors) { ParameterInfo[] parameters = constructorInfo2.GetParameters(); if (parameters.Length >= 4 && parameters[0].ParameterType == typeof(string) && parameters[1].ParameterType == typeof(KeyCode) && parameters[2].ParameterType == typeof(int) && parameters[3].ParameterType == typeof(string)) { constructorInfo = constructorInfo2; break; } } if (constructorInfo == null) { throw new MissingMethodException(type.FullName, "supported constructor"); } ParameterInfo[] parameters2 = constructorInfo.GetParameters(); object[] array = new object[parameters2.Length]; array[0] = "TIMPANIST_DEDICATED_ROLL"; array[1] = (object)(KeyCode)0; array[2] = -1; array[3] = "SecondarySkill"; for (int j = 4; j < array.Length; j++) { if (!parameters2[j].HasDefaultValue) { throw new MissingMethodException("Unsupported binding constructor"); } array[j] = parameters2[j].DefaultValue; } object obj = constructorInfo.Invoke(array); MethodInfo? method = type2.GetMethod("RegisterModKeybind", new Type[1] { type }); if (method == null) { throw new MissingMethodException(type2.FullName, "RegisterModKeybind"); } obj = method.Invoke(null, new object[1] { obj }); MethodInfo method2 = type.GetMethod("GetButtonState", new Type[1] { typeof(InputBankTest) }); read = (Func)Delegate.CreateDelegate(typeof(Func), obj, method2); Plugin.Log("Optional Rebindables dedicated-roll integration registered."); } catch (Exception ex) { read = null; Plugin.Log("Optional Rebindables unavailable: " + ex.Message + ". Chord roll remains available."); } } internal static bool Down(InputBankTest input) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (read == null || !Object.op_Implicit((Object)(object)input)) { return false; } try { return read(input).down; } catch (Exception ex) { read = null; Plugin.Log("Optional dedicated binding disabled after input error: " + ex.Message + ". Chord roll remains available."); return false; } } } [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.rodanius.timpanistsurvivor", "The Timpanist", "0.3.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.rodanius.timpanistsurvivor"; internal static Plugin Instance; internal static ConfigEntry Chord; internal static ConfigEntry Diagnostics; internal static ConfigEntry NativeSound; internal static ConfigEntry CameraDistance; internal static ConfigEntry CameraOffset; internal static ConfigEntry AudioVolume; private void Awake() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown Instance = this; NativeSound = ((BaseUnityPlugin)this).Config.Bind("Audio", "Native Percussive Layer", false, "Legacy setting retained; 0.3.2 uses custom PCM drum strikes and continuous rolls."); Chord = ((BaseUnityPlugin)this).Config.Bind("Controls", "Chord Roll Enabled", true, "Legacy setting retained for config compatibility; 0.3.2 uses Primary strikes and Secondary rolls."); Diagnostics = ((BaseUnityPlugin)this).Config.Bind("Development", "Diagnostics", false, "Write cast/item catalogs for private tests; never grants items or modifies a run."); AudioVolume = ((BaseUnityPlugin)this).Config.Bind("Audio", "Timpani Volume", 0.35f, "Custom drum output volume, independent of the game SFX slider. Set to zero to mute. Native playback requires a Windows game test."); CameraDistance = ((BaseUnityPlugin)this).Config.Bind("Camera", "Distance", 6.5f, (ConfigDescription)null); CameraOffset = ((BaseUnityPlugin)this).Config.Bind("Camera", "Horizontal Offset", 0.25f, (ConfigDescription)null); LanguageAPI.Add("TIMPANIST_DEDICATED_ROLL", "Dedicated Roll"); ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(Collect); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(Stats); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RuntimeAudit.ExportIfEnabled)); Log("Timpanist 0.3.2 initialized; content provider subscribed."); } private static void RegisterBinding() { OptionalBinding.Register(); } private void Collect(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new TimpanistContent()); } private static void Stats(CharacterBody body, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)Content.Poise) && body.HasBuff(Content.Poise)) { args.armorAdd += 50f; } if (Object.op_Implicit((Object)(object)Content.LowFull) && body.HasBuff(Content.LowFull)) { args.armorAdd += 40f; } else if (Object.op_Implicit((Object)(object)Content.LowResonant) && body.HasBuff(Content.LowResonant)) { args.armorAdd += 24f; } else if (Object.op_Implicit((Object)(object)Content.LowHalf) && body.HasBuff(Content.LowHalf)) { args.armorAdd += 20f; } if (Object.op_Implicit((Object)(object)Content.MidFull) && body.HasBuff(Content.MidFull)) { args.moveSpeedReductionMultAdd += 0.42857146f; } else if (Object.op_Implicit((Object)(object)Content.MidResonant) && body.HasBuff(Content.MidResonant)) { args.moveSpeedReductionMultAdd += 0.21951221f; } else if (Object.op_Implicit((Object)(object)Content.MidHalf) && body.HasBuff(Content.MidHalf)) { args.moveSpeedReductionMultAdd += 0.1764706f; } } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ContentManager.collectContentPackProviders -= new CollectContentPackProvidersDelegate(Collect); RecalculateStatsAPI.GetStatCoefficients -= new StatHookEventHandler(Stats); RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(RuntimeAudit.ExportIfEnabled)); } internal static void Log(string text) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)text); } } internal static class PluginExtensions { public static bool AnyPluginNamed(this IEnumerable items, string name) { foreach (PluginInfo item in items) { if (item.Metadata.Name.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } } public sealed class TimpanistContent : IContentPackProvider { private readonly ContentPack pack = new ContentPack(); public string identifier => "com.rodanius.timpanistsurvivor"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { typeof(ContentPack).GetProperty("identifier").SetValue(pack, identifier, null); Content.Build(pack); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(pack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public static class Presentation { private static readonly Color[] colors = (Color[])(object)new Color[8] { Graybox.Bay, Graybox.Black, Graybox.Metal, Graybox.Copper, Graybox.Ivory, Graybox.Green, Color32.op_Implicit(new Color32((byte)200, (byte)172, (byte)98, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)169, (byte)130, (byte)83, byte.MaxValue)) }; public static string AssetPath(string name) { return Path.Combine(Path.GetDirectoryName(typeof(Plugin).Assembly.Location), "assets", name); } private static Vector3 V(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 string S(BinaryReader r) { int num = r.ReadInt32(); if (num < 0 || num > 256) { throw new InvalidDataException("Invalid node name"); } return Encoding.UTF8.GetString(r.ReadBytes(num)); } public static bool TryBuild(Transform root, Material template) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Expected O, but got Unknown //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(AssetPath("character-lod0.timp"))) { return false; } List list = new List(); GameObject val = new GameObject("TimpanistPresentation"); val.transform.SetParent(root, false); try { Material[] array = (Material[])(object)new Material[8]; for (int i = 0; i < 8; i++) { array[i] = Graybox.Material(template, colors[i]); list.Add((Object)(object)array[i]); } Transform[] array2 = null; List list2 = new List(); Renderer[][] array3 = new Renderer[3][]; Quaternion localRotation = default(Quaternion); for (int j = 0; j < 3; j++) { using BinaryReader binaryReader = new BinaryReader(File.OpenRead(AssetPath("character-lod" + j + ".timp"))); if (Encoding.ASCII.GetString(binaryReader.ReadBytes(8)) != "TIMP0001") { throw new InvalidDataException("Unknown mesh format"); } int num = binaryReader.ReadInt32(); if (num < 1 || num > 100) { throw new InvalidDataException("Skeleton budget"); } if (j == 0) { array2 = (Transform[])(object)new Transform[num]; } else if (num != array2.Length) { throw new InvalidDataException("LOD skeleton mismatch"); } for (int k = 0; k < num; k++) { string text = S(binaryReader); int num2 = binaryReader.ReadInt32(); Vector3 localPosition = V(binaryReader); ((Quaternion)(ref localRotation))..ctor(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); Vector3 localScale = V(binaryReader); if (num2 >= k || num2 < -1) { throw new InvalidDataException("Skeleton order"); } if (j == 0) { array2[k] = new GameObject(text).transform; array2[k].SetParent((num2 < 0) ? val.transform : array2[num2], false); array2[k].localPosition = localPosition; array2[k].localRotation = localRotation; array2[k].localScale = localScale; } else if (((Object)array2[k]).name != text) { throw new InvalidDataException("LOD bone identity"); } } List list3 = new List(); List list4 = new List(); List list5 = new List(); List[] array4 = new List[8]; for (int l = 0; l < 8; l++) { array4[l] = new List(); } int num3 = binaryReader.ReadInt32(); if (num3 < 1 || num3 > 512) { throw new InvalidDataException("Part count"); } for (int m = 0; m < num3; m++) { S(binaryReader); int num4 = binaryReader.ReadInt32(); int num5 = binaryReader.ReadInt32(); int num6 = binaryReader.ReadInt32(); if (num4 < 0 || num4 >= num || num5 < 0 || num5 >= 8 || num6 < 0 || num6 > 65000) { throw new InvalidDataException("Mesh budget"); } int count = list3.Count; for (int n = 0; n < num6; n++) { list3.Add(V(binaryReader)); list4.Add(V(binaryReader)); BoneWeight item = default(BoneWeight); ((BoneWeight)(ref item)).boneIndex0 = num4; ((BoneWeight)(ref item)).weight0 = 1f; list5.Add(item); } int num7 = binaryReader.ReadInt32(); if (num7 < 0 || num7 > 120000 || num7 % 3 != 0) { throw new InvalidDataException("Triangle budget"); } for (int num8 = 0; num8 < num7; num8++) { int num9 = binaryReader.ReadInt32(); if (num9 < 0 || num9 >= num6) { throw new InvalidDataException("Mesh index"); } array4[num5].Add(count + num9); } } if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) { throw new InvalidDataException("Trailing mesh data"); } Matrix4x4[] array5 = (Matrix4x4[])(object)new Matrix4x4[num]; for (int num10 = 0; num10 < num; num10++) { array5[num10] = array2[num10].worldToLocalMatrix * val.transform.localToWorldMatrix; } array3[j] = (Renderer[])(object)new Renderer[8]; for (int num11 = 0; num11 < 8; num11++) { Mesh val2 = new Mesh { name = "TimpanistLOD" + j + "Material" + num11, indexFormat = (IndexFormat)1 }; list.Add((Object)(object)val2); val2.SetVertices(list3); val2.SetNormals(list4); val2.boneWeights = list5.ToArray(); val2.bindposes = array5; val2.SetTriangles(array4[num11], 0); val2.RecalculateBounds(); GameObject val3 = new GameObject(((Object)val2).name); val3.transform.SetParent(val.transform, false); SkinnedMeshRenderer val4 = val3.AddComponent(); val4.sharedMesh = val2; ((Renderer)val4).sharedMaterial = array[num11]; val4.bones = array2; val4.rootBone = array2[0]; ((Renderer)val4).localBounds = new Bounds(new Vector3(0f, 1.2f, 0f), new Vector3(2.4f, 3.3f, 4f)); val4.updateWhenOffscreen = false; list2.Add((Renderer)(object)val4); array3[j][num11] = (Renderer)(object)val4; } } LODGroup val5 = val.AddComponent(); val5.SetLODs((LOD[])(object)new LOD[3] { new LOD(0.28f, array3[0]), new LOD(0.12f, array3[1]), new LOD(0.025f, array3[2]) }); val5.RecalculateBounds(); val.AddComponent(); val.AddComponent(); val.AddComponent(); return true; } catch (Exception ex) { Object.DestroyImmediate((Object)(object)val); foreach (Object item2 in list) { if (Object.op_Implicit(item2)) { Object.DestroyImmediate(item2); } } Plugin.Log("Presentation fallback: " + ex); return false; } } } public sealed class PresentationAudio : MonoBehaviour { private TimpanistController controller; private CharacterModel model; private CustomPcmOutput output; private bool appPaused; private bool focused = true; private float retryAt; private void Awake() { model = ((Component)this).GetComponentInParent(); focused = Application.isFocused; } private bool Context() { if (!Object.op_Implicit((Object)(object)model)) { model = ((Component)this).GetComponentInParent(); } if (!Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)model.body)) { controller = ((Component)model.body).GetComponent(); } if (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.Body) && Object.op_Implicit((Object)(object)controller.Body.master) && Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)controller.Body.healthComponent)) { return controller.Body.healthComponent.alive; } return false; } private bool Allowed() { if (Context() && !appPaused && focused) { return Time.timeScale > 0.001f; } return false; } private void EnsureOutput() { if (output == null && !(Time.unscaledTime < retryAt) && Allowed()) { retryAt = Time.unscaledTime + 2f; output = CustomPcmOutput.TryCreate(Presentation.AssetPath("audio"), Plugin.Log); } } private void Update() { CustomPcmOutput.PumpMessages(Plugin.Log); if (!Allowed()) { Release(); return; } EnsureOutput(); if (output != null) { ApplyMix(); output.PumpLogs(); } } private void ApplyMix() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) float num = 1f; float pan = 0f; Camera val = null; foreach (CameraRigController readOnlyInstances in CameraRigController.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && readOnlyInstances.localUserViewer != null && Object.op_Implicit((Object)(object)readOnlyInstances.sceneCam) && ((Behaviour)readOnlyInstances.sceneCam).isActiveAndEnabled) { val = readOnlyInstances.sceneCam; break; } } if (Object.op_Implicit((Object)(object)val)) { Vector3 val2 = controller.Body.corePosition - ((Component)val).transform.position; float magnitude = ((Vector3)(ref val2)).magnitude; num = ((magnitude <= 3f) ? 1f : (1f / (1f + (magnitude - 3f) * 0.08f))); num *= Mathf.Clamp01((55f - magnitude) / 10f); if (magnitude > 0.01f) { pan = Mathf.Clamp(Vector3.Dot(((Component)val).transform.right, val2 / magnitude), -1f, 1f); } } else { num = (controller.Body.hasEffectiveAuthority ? 1 : 0); } byte b = (byte)(controller.InputAllowed() ? controller.VisualMask : 0); output.SetMix(Mathf.Clamp01(Plugin.AudioVolume.Value) * num, pan, audible: true, (b & 1) != 0, (int)controller.Pitch(right: false), (b & 2) != 0, (int)controller.Pitch(right: true), 0.65f); } public static void Strike(CharacterBody body, bool right, float gain = 1f) { try { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { PresentationAudio componentInChildren = ((Component)body.modelLocator.modelTransform).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.PlayStrike(right, gain); } } } catch (Exception ex) { Plugin.Log("Custom timpani strike unavailable: " + ex.Message); } } private void PlayStrike(bool right, float gain) { if (Allowed()) { EnsureOutput(); if (output != null) { ApplyMix(); output.Strike(right, (int)controller.Pitch(right), Mathf.Clamp01(gain)); output.PumpLogs(); } } } public static void Cue(CharacterBody body, string cue) { } private void Release() { if (output != null) { output.SetMix(0f, 0f, audible: false, leftRoll: false, 0, rightRoll: false, 0, 0f); output.Dispose(); output.PumpLogs(); output = null; } } private void OnApplicationPause(bool paused) { appPaused = paused; if (paused) { Release(); } } private void OnApplicationFocus(bool hasFocus) { focused = hasFocus; if (!hasFocus) { Release(); } } private void OnApplicationQuit() { Release(); } private void OnDisable() { Release(); } private void OnDestroy() { Release(); } } public sealed class PresentationMotion : MonoBehaviour { private static readonly string[] legs = new string[4] { "LFront", "RFront", "LRear", "RRear" }; private readonly Dictionary n = new Dictionary(); private readonly Dictionary rotation = new Dictionary(); private readonly Dictionary position = new Dictionary(); private TimpanistController c; private CharacterModel model; private float phase; private float deathAt = -1f; private bool corpse; public void MakeCorpse() { corpse = true; deathAt = Time.time; } private void Start() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (Transform val in componentsInChildren) { n[((Object)val).name] = val; rotation[((Object)val).name] = val.localRotation; position[((Object)val).name] = val.localPosition; } model = ((Component)this).GetComponentInParent(); } private void Rotate(string name, Vector3 v) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (n.TryGetValue(name, out var value)) { value.localRotation = rotation[name] * Quaternion.Euler(v); } } private static float StrikeLift(float t) { if (t < 0f || t > 0.62f) { return 0f; } if (t < 0.065f) { return Mathf.Lerp(0f, 1f, t / 0.065f); } if (t < 0.12f) { return Mathf.Lerp(1f, 0f, (t - 0.065f) / 0.055f); } if (t < 0.3f) { return Mathf.Lerp(0f, 0.8f, (t - 0.12f) / 0.18f); } return Mathf.Lerp(0.8f, 0f, (t - 0.3f) / 0.32f); } private void LateUpdate() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: 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_07d2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)model.body)) { c = ((Component)model.body).GetComponent(); } float num; if (!Object.op_Implicit((Object)(object)c) || !Object.op_Implicit((Object)(object)c.Body.characterMotor)) { num = 0f; } else { Vector3 val = Vector3.ProjectOnPlane(c.Body.characterMotor.velocity, Vector3.up); num = ((Vector3)(ref val)).magnitude; } float num2 = num; phase += Time.deltaTime * ((num2 > 0.1f) ? Mathf.Min(21f, num2 * 1.8f) : 1.7f); int num3; if (!corpse) { if (Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)c.Body.healthComponent)) { num3 = ((!c.Body.healthComponent.alive) ? 1 : 0); if (num3 != 0) { goto IL_0116; } } else { num3 = 0; } goto IL_012e; } num3 = 1; goto IL_0116; IL_012e: string[] array; if (num3 != 0) { float num4 = Mathf.SmoothStep(0f, 1f, (Time.time - deathAt) / 0.85f); if (n.TryGetValue("Root", out var value)) { value.localRotation = Quaternion.Euler(0f, 0f, -68f * num4); value.localPosition = new Vector3(0f, -0.18f * num4, 0f); } array = legs; foreach (string text in array) { Rotate("Leg" + text, new Vector3(-35f * num4, 0f, 0f)); Rotate("Knee" + text, new Vector3(70f * num4, 0f, 0f)); } Rotate("RiderChest", new Vector3(40f * num4, 0f, 12f * num4)); Rotate("HorseNeck", new Vector3(30f * num4, 0f, 0f)); return; } bool flag = Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)c.Body.characterMotor) && !c.Body.characterMotor.isGrounded; bool flag2 = Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)c.Cavalry) && c.Cavalry.state is ChargeState; array = legs; foreach (string text2 in array) { float num5 = ((num2 > 10f) ? (text2 switch { "LRear" => 2.5f, "RFront" => 0.6f, "LFront" => 0f, _ => 3.1f, }) : ((text2 == "LFront" || text2 == "RRear") ? 0f : ((float)Math.PI))); float num6 = (flag ? 18f : (Mathf.Sin(phase + num5) * Mathf.Min(44f, num2 * 4f))); Rotate("Leg" + text2, new Vector3(num6, 0f, 0f)); Rotate("Knee" + text2, new Vector3(flag ? 25f : (Mathf.Max(0f, 0f - num6) * 0.7f), 0f, 0f)); } Rotate("HorseNeck", new Vector3(Mathf.Sin(phase) * 1.5f + (float)(flag2 ? 8 : 0), 0f, 0f)); Rotate("Tail", new Vector3(0f, Mathf.Sin(phase * 0.65f) * 8f, 0f)); Rotate("BannerL", new Vector3(num2 * 1.2f + Mathf.Sin(phase) * 3f, 0f, 0f)); Rotate("BannerR", new Vector3(num2 * 1.2f - Mathf.Sin(phase) * 3f, 0f, 0f)); byte b = (byte)(Object.op_Implicit((Object)(object)c) ? c.VisualMask : 0); float num7 = b switch { 2 => 0.26f, 1 => -0.26f, _ => 0f, }; if (n.TryGetValue("RiderChest", out var value2)) { value2.localPosition = position["RiderChest"] + new Vector3(num7, 0f, 0f); Rotate("RiderChest", new Vector3(flag2 ? 18f : (Mathf.Sin(Mathf.Clamp01((Time.time - Mathf.Max(Object.op_Implicit((Object)(object)c) ? c.LeftFlash : (-100f), Object.op_Implicit((Object)(object)c) ? c.RightFlash : (-100f))) / 0.62f) * (float)Math.PI) * -7f), (float)(b switch { 2 => 45, 1 => -45, _ => 0, }), 0f)); } float num8 = (Object.op_Implicit((Object)(object)c) ? ((Time.time - c.RollClock) * Mathf.Min(7f, 5.55f * Mathf.Sqrt(Rules.Speed(c.Body.attackSpeed))) * (float)Math.PI) : 0f); for (int j = 0; j < 2; j++) { string text3 = ((j == 0) ? "L" : "R"); int drum = b switch { 2 => 1, 1 => 0, _ => j, }; float num9 = ((!Object.op_Implicit((Object)(object)c)) ? (-100f) : ((j == 0) ? c.LeftFlash : c.RightFlash)); float lift = ((b != 0) ? ((1f - Mathf.Cos(num8 + ((j == 1) ? ((float)Math.PI) : 0f))) * 0.5f) : StrikeLift(Object.op_Implicit((Object)(object)c) ? ((Time.time - num9) * Rules.Speed(c.StrokeSpeed)) : 1f)); if (flag2) { lift = 0.75f; } AnimateHand(text3, drum, lift, b != 0); float num10 = ((Object.op_Implicit((Object)(object)c) && c.LastTuneRight == (j == 1)) ? Mathf.Sin(Mathf.Clamp01((Time.time - c.TuneFlash) / 0.25f) * (float)Math.PI) : 0f); Rotate("Pedal" + text3, new Vector3(num10 * 18f, 0f, 0f)); Rotate("Gauge" + text3, new Vector3(0f, (float)(Object.op_Implicit((Object)(object)c) ? ((int)(c.Pitch(j == 1) - 1) * 30) : ((j == 0) ? (-30) : 30)), 0f)); } return; IL_0116: if (deathAt < 0f) { deathAt = Time.time; } goto IL_012e; } private void AnimateHand(string side, int drum, float lift, bool rolling) { //IL_007a: 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_00a8: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) if (n.TryGetValue("Shoulder" + side, out var value) && n.TryGetValue("Elbow" + side, out var value2) && n.TryGetValue("Hand" + side, out var value3) && n.TryGetValue((drum == 0) ? "HeadStrikeL" : "HeadStrikeR", out var value4)) { value.localRotation = rotation[((Object)value).name]; value2.localRotation = rotation[((Object)value2).name]; value3.localRotation = rotation[((Object)value3).name]; Vector3 val = value4.position + ((Component)this).transform.TransformVector(new Vector3((!rolling) ? 0f : ((!(side == "L")) ? ((drum == 0) ? 0.135f : 0.045f) : ((drum == 1) ? (-0.135f) : (-0.045f))), 0f, 0.035f)); Vector3 val2 = val + ((Component)this).transform.TransformVector(new Vector3(0f, 0.325f, -0.09f)); Vector3 val3 = value.position + ((Component)this).transform.TransformVector(new Vector3((side == "L") ? (-0.1f) : 0.1f, 0.35f, -0.08f)); Solve(target: Vector3.Lerp(val2, val3, Mathf.SmoothStep(0f, 1f, lift)) + ((Component)this).transform.TransformVector(new Vector3(0f, 0f, 0.1f * Mathf.Sin((float)Math.PI * lift))), shoulder: value, elbow: value2, hand: value3, pole: n["RiderChest"].TransformDirection(new Vector3((float)((!(side == "L")) ? 1 : (-1)), 0f, 2f))); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor((side == "L") ? (-0.04f) : 0.04f, -0.1f, 0.295f); Vector3 val5 = val - value3.position; Vector3 val6 = Vector3.Slerp(((Vector3)(ref val5)).normalized, ((Component)this).transform.TransformDirection(new Vector3(0f, 1f, -0.1f)), lift); val5 = Vector3.ProjectOnPlane(((Component)this).transform.up, val6); Vector3 val7 = ((Vector3)(ref val5)).normalized; if (((Vector3)(ref val7)).sqrMagnitude < 0.01f) { val7 = ((Component)this).transform.forward; } value3.rotation = Quaternion.LookRotation(val6, val7) * Quaternion.Inverse(Quaternion.LookRotation(((Vector3)(ref val4)).normalized, Vector3.up)); } } private static void Solve(Transform shoulder, Transform elbow, Transform hand, Vector3 target, Vector3 pole) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) Vector3 val = shoulder.position; Vector3 val2 = target - val; float num = Vector3.Distance(val, elbow.position); float num2 = Vector3.Distance(elbow.position, hand.position); float num3 = Mathf.Clamp(((Vector3)(ref val2)).magnitude, 0.02f, num + num2 - 0.001f); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = Vector3.ProjectOnPlane(pole, normalized); Vector3 normalized2 = ((Vector3)(ref val3)).normalized; float num4 = (num * num - num2 * num2 + num3 * num3) / (2f * num3); float num5 = Mathf.Sqrt(Mathf.Max(0f, num * num - num4 * num4)); Vector3 val4 = val + normalized * num4 + normalized2 * num5; shoulder.rotation = Quaternion.FromToRotation(elbow.position - val, val4 - val) * shoulder.rotation; elbow.rotation = Quaternion.FromToRotation(hand.position - elbow.position, val + normalized * num3 - elbow.position) * elbow.rotation; } } public static class PresentationRagdoll { public static void Release(CharacterBody body) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_01e4: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_065a: 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_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform) || Application.isBatchMode) { return; } PresentationMotion componentInChildren = ((Component)body.modelLocator.modelTransform).GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)componentInChildren) || !((Behaviour)componentInChildren).enabled) { return; } ((Behaviour)componentInChildren).enabled = false; GameObject val = null; try { val = Object.Instantiate(((Component)componentInChildren).gameObject, ((Component)componentInChildren).transform.position, ((Component)componentInChildren).transform.rotation); ((Object)val).name = "TimpanistPhysicsCorpse"; MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren(); foreach (MonoBehaviour obj in componentsInChildren) { ((Behaviour)obj).enabled = false; Object.Destroy((Object)(object)obj); } AudioSource[] componentsInChildren2 = val.GetComponentsInChildren(); foreach (AudioSource obj2 in componentsInChildren2) { obj2.Stop(); Object.Destroy((Object)(object)obj2); } Renderer[] componentsInChildren3 = val.GetComponentsInChildren(); foreach (Renderer val2 in componentsInChildren3) { val2.enabled = !(val2 is LineRenderer) && !(val2 is TrailRenderer); } LODGroup[] componentsInChildren4 = val.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren4.Length; i++) { componentsInChildren4[i].ForceLOD(0); } Dictionary nodes = new Dictionary(); Transform[] componentsInChildren5 = val.GetComponentsInChildren(); foreach (Transform val3 in componentsInChildren5) { nodes[((Object)val3).name] = val3; } Dictionary rigid = new Dictionary(); List colliders = new List(); Action action = delegate(string name, float mass, Vector3 center, Vector3 size) { //IL_007c: 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) if (nodes.TryGetValue(name, out var value)) { ((Component)value).gameObject.layer = LayerIndex.ragdoll.intVal; Rigidbody val7 = ((Component)value).gameObject.AddComponent(); val7.mass = mass; val7.isKinematic = true; val7.interpolation = (RigidbodyInterpolation)1; val7.collisionDetectionMode = (CollisionDetectionMode)2; val7.maxAngularVelocity = 12f; val7.drag = 0.25f; val7.angularDrag = 0.7f; BoxCollider val8 = ((Component)value).gameObject.AddComponent(); val8.center = center; val8.size = size; rigid[name] = val7; colliders.Add((Collider)(object)val8); } }; action("HorsePelvis", 28f, Vector3.zero, new Vector3(0.55f, 0.55f, 0.65f)); action("HorseChest", 30f, Vector3.zero, new Vector3(0.55f, 0.65f, 0.65f)); action("HorseNeck", 8f, new Vector3(0f, 0.2f, 0.14f), new Vector3(0.25f, 0.45f, 0.35f)); action("HorseHead", 6f, new Vector3(0f, -0.04f, 0.15f), new Vector3(0.27f, 0.3f, 0.5f)); action("Saddle", 4f, Vector3.zero, new Vector3(0.45f, 0.12f, 0.55f)); action("RiderPelvis", 7f, Vector3.zero, new Vector3(0.3f, 0.2f, 0.3f)); action("RiderChest", 12f, new Vector3(0f, 0.12f, 0f), new Vector3(0.45f, 0.4f, 0.33f)); action("Helmet", 4f, Vector3.zero, new Vector3(0.22f, 0.28f, 0.25f)); string[] array = new string[2] { "L", "R" }; foreach (string text in array) { action("Shoulder" + text, 2f, new Vector3((text == "L") ? (-0.06f) : 0.06f, -0.1f, 0f), new Vector3(0.14f, 0.26f, 0.16f)); action("Elbow" + text, 1.5f, new Vector3((text == "L") ? (-0.07f) : 0.07f, -0.07f, 0f), new Vector3(0.18f, 0.2f, 0.14f)); action("Thigh" + text, 3f, new Vector3((text == "L") ? (-0.1f) : 0.1f, -0.2f, 0.1f), new Vector3(0.18f, 0.4f, 0.22f)); string[] array2 = new string[2] { "Front", "Rear" }; foreach (string text2 in array2) { action("Leg" + text + text2, 4f, new Vector3(0f, -0.23f, 0f), new Vector3(0.14f, 0.45f, 0.16f)); action("Knee" + text + text2, 2f, new Vector3(0f, -0.22f, 0f), new Vector3(0.12f, 0.42f, 0.14f)); } } foreach (KeyValuePair item in rigid) { string text3 = null; if (item.Key == "HorseChest" || item.Key == "Saddle") { text3 = "HorsePelvis"; } else { Transform parent = ((Component)item.Value).transform.parent; while (Object.op_Implicit((Object)(object)parent) && (Object)(object)parent != (Object)(object)val.transform) { if (rigid.ContainsKey(((Object)parent).name)) { text3 = ((Object)parent).name; break; } parent = parent.parent; } } if (text3 != null) { if (item.Key == "Saddle") { FixedJoint obj3 = ((Component)item.Value).gameObject.AddComponent(); ((Joint)obj3).connectedBody = rigid[text3]; ((Joint)obj3).enableCollision = false; continue; } CharacterJoint obj4 = ((Component)item.Value).gameObject.AddComponent(); ((Joint)obj4).connectedBody = rigid[text3]; ((Joint)obj4).enableCollision = false; SoftJointLimit val4 = default(SoftJointLimit); ((SoftJointLimit)(ref val4)).limit = -25f; obj4.lowTwistLimit = val4; val4 = default(SoftJointLimit); ((SoftJointLimit)(ref val4)).limit = 25f; obj4.highTwistLimit = val4; val4 = default(SoftJointLimit); ((SoftJointLimit)(ref val4)).limit = 45f; obj4.swing1Limit = val4; val4 = default(SoftJointLimit); ((SoftJointLimit)(ref val4)).limit = 30f; obj4.swing2Limit = val4; obj4.enableProjection = true; } } Collider[] componentsInChildren6 = ((Component)body).GetComponentsInChildren(); for (int num2 = 0; num2 < colliders.Count; num2++) { for (int num3 = 0; num3 < num2; num3++) { Physics.IgnoreCollision(colliders[num2], colliders[num3]); } Collider[] array3 = componentsInChildren6; foreach (Collider val5 in array3) { if (Object.op_Implicit((Object)(object)val5)) { Physics.IgnoreCollision(colliders[num2], val5); } } } Vector3 val6 = (Object.op_Implicit((Object)(object)body.characterMotor) ? body.characterMotor.velocity : Vector3.zero); foreach (Rigidbody value2 in rigid.Values) { value2.isKinematic = false; value2.velocity = Vector3.ClampMagnitude(val6, 30f); value2.angularVelocity = ((Component)body).transform.forward * 1.5f; } ((Component)componentInChildren).gameObject.SetActive(false); Object.Destroy((Object)(object)val, 10f); } catch (Exception ex) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } Plugin.Log("Ragdoll setup failed: " + ex.Message); } } } public sealed class PressureVisual : MonoBehaviour { internal static Material Template; private Mesh mesh; private Material material; private float age; private float duration; private float radius; private float strength; private Tuning mode; private bool strike; private CharacterBody body; private const int Segments = 64; private Vector3[] vertices; private int[] triangles; public static Color ColorFor(Tuning t) { //IL_0040: 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_0016: Unknown result type (might be due to invalid IL or missing references) return (Color)(t switch { Tuning.Mid => new Color(1f, 0.58f, 0.07f), Tuning.Low => new Color(0.12f, 1f, 0.68f), _ => new Color(0.28f, 0.65f, 1f), }); } public static Material CreateMaterial(Color color) { //IL_0013: 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) if (!Object.op_Implicit((Object)(object)Template)) { return null; } Material obj = Graybox.Material(Template, color); Tint(obj, color, 2f); return obj; } private static void Tint(Material m, Color color, float brightness) { //IL_0013: 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) if (m.HasProperty("_Color")) { m.SetColor("_Color", color); } if (m.HasProperty("_EmColor")) { m.SetColor("_EmColor", color); } if (m.HasProperty("_EmPower")) { m.SetFloat("_EmPower", brightness); } } public static void Emit(CharacterBody body, Tuning mode, float size, bool primary = false, float strength = 1f) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)body) || Application.isBatchMode || !Object.op_Implicit((Object)(object)Template)) { return; } GameObject val = null; try { val = new GameObject("TimpanistSonic" + (primary ? "Strike" : "Field")); PressureVisual pressureVisual = val.AddComponent(); pressureVisual.body = body; pressureVisual.mode = mode; pressureVisual.radius = size; pressureVisual.strike = primary; pressureVisual.strength = strength; pressureVisual.duration = (primary ? 0.4f : 0.5f); Ray val2 = Combat.Aim(body); val.transform.position = ((Ray)(ref val2)).origin; val.transform.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref val2)).direction); pressureVisual.material = CreateMaterial(ColorFor(mode)); pressureVisual.mesh = new Mesh { name = "TimpanistWaveRibbon" }; pressureVisual.vertices = (Vector3[])(object)new Vector3[390]; pressureVisual.triangles = new int[2304]; int num = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 64; j++) { int num2 = i * 65 * 2 + j * 2; int[] array = new int[12] { num2, num2 + 2, num2 + 1, num2 + 1, num2 + 2, num2 + 3, num2 + 1, num2 + 2, num2, num2 + 3, num2 + 2, num2 + 1 }; foreach (int num3 in array) { pressureVisual.triangles[num++] = num3; } } } val.AddComponent().sharedMesh = pressureVisual.mesh; MeshRenderer obj = val.AddComponent(); ((Renderer)obj).sharedMaterial = pressureVisual.material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; pressureVisual.Draw(0f); } catch (Exception ex) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } Plugin.Log("Optional sonic effect unavailable: " + ex.Message); } } private void Update() { age += Time.deltaTime; float num = age / duration; if (num >= 1f || !Object.op_Implicit((Object)(object)body)) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Draw(num); } } private void Draw(float q) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (flag) { ((Component)this).transform.position = body.footPosition + Vector3.up * 0.08f; ((Component)this).transform.rotation = Quaternion.identity; } float num = (strike ? 0.38f : 0.16f); Color val = ColorFor(mode); float num2 = Mathf.Max(0.12f, 1f - q); Tint(material, val * num2, 2.5f * num2 * strength); for (int i = 0; i < 3; i++) { float num3 = Mathf.Clamp01(q - (float)i * 0.1f); float num4 = (flag ? (radius * (0.94f + 0.06f * num3)) : Mathf.Lerp(0.28f, radius, num3)); for (int j = 0; j <= 64; j++) { float num5 = (flag ? ((float)j / 64f * 360f) : Mathf.Lerp(0f - (strike ? 38f : 50f), strike ? 38f : 50f, (float)j / 64f)) * ((float)Math.PI / 180f); Vector3 val2 = (flag ? new Vector3(Mathf.Cos(num5), 0f, Mathf.Sin(num5)) : new Vector3(Mathf.Sin(num5), 0f, Mathf.Cos(num5))); Vector3 val3 = val2 * num4 + Vector3.up * (flag ? ((float)i * 0.25f) : ((float)(i - 1) * (0.3f + num3 * 0.6f))); int num6 = (i * 65 + j) * 2; vertices[num6] = val3 - val2 * num; vertices[num6 + 1] = val3 + val2 * num; } } mesh.vertices = vertices; mesh.triangles = triangles; mesh.RecalculateNormals(); mesh.RecalculateBounds(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } } public static class RuntimeAudit { [Serializable] public sealed class Catalog { public string utc; public string assemblySha256; public string build; public List mods = new List(); public List definitions = new List(); public string status = "Runtime exported; functional and display tests NOT RUN"; } [Serializable] public sealed class Row { public string stableName; public string displayName; public string kind; public string tier; public string expansion; public string availability = "Requires run/catalog classification"; public string owner = "Unresolved: resolve content pack in audit"; public string functional = "Not run"; public string visual = "Not run"; public bool hidden; } private static string Owner(Object definition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //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_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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) Enumerator enumerator = ContentManager.allLoadedContentPacks.GetEnumerator(); try { while (enumerator.MoveNext()) { ReadOnlyContentPack current = enumerator.Current; AssetEnumerator enumerator2 = ((ReadOnlyContentPack)(ref current)).itemDefs.GetEnumerator(); try { while (enumerator2.MoveNext()) { if ((Object)(object)enumerator2.Current == definition) { return ((ReadOnlyContentPack)(ref current)).identifier; } } } finally { ((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } AssetEnumerator enumerator3 = ((ReadOnlyContentPack)(ref current)).equipmentDefs.GetEnumerator(); try { while (enumerator3.MoveNext()) { if ((Object)(object)enumerator3.Current == definition) { return ((ReadOnlyContentPack)(ref current)).identifier; } } } finally { ((IDisposable)enumerator3/*cast due to .constrained prefix*/).Dispose(); } AssetEnumerator enumerator4 = ((ReadOnlyContentPack)(ref current)).keyItemDefs.GetEnumerator(); try { while (enumerator4.MoveNext()) { if ((Object)(object)enumerator4.Current == definition) { return ((ReadOnlyContentPack)(ref current)).identifier; } } } finally { ((IDisposable)enumerator4/*cast due to .constrained prefix*/).Dispose(); } AssetEnumerator enumerator5 = ((ReadOnlyContentPack)(ref current)).cursedBookSpellDefs.GetEnumerator(); try { while (enumerator5.MoveNext()) { if ((Object)(object)enumerator5.Current == definition) { return ((ReadOnlyContentPack)(ref current)).identifier; } } } finally { ((IDisposable)enumerator5/*cast due to .constrained prefix*/).Dispose(); } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return "Unresolved"; } public unsafe static void ExportIfEnabled() { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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) //IL_0365: Expected O, but got Unknown if (!Plugin.Diagnostics.Value) { return; } try { Catalog catalog = new Catalog { utc = DateTime.UtcNow.ToString("O"), build = Application.version }; using (SHA256 sHA = SHA256.Create()) { catalog.assemblySha256 = BitConverter.ToString(sHA.ComputeHash(File.ReadAllBytes(typeof(CharacterBody).Assembly.Location))).Replace("-", "").ToLowerInvariant(); } foreach (PluginInfo value in Chainloader.PluginInfos.Values) { catalog.mods.Add(value.Metadata.GUID + "@" + value.Metadata.Version); } Enumerator enumerator2 = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator2.MoveNext()) { ItemDef current2 = enumerator2.Current; catalog.definitions.Add(new Row { stableName = ((Object)current2).name, displayName = Language.GetString(current2.nameToken), kind = "item", tier = ((object)current2.tier/*cast due to .constrained prefix*/).ToString(), hidden = current2.hidden, owner = Owner((Object)(object)current2), expansion = (Object.op_Implicit((Object)(object)current2.requiredExpansion) ? ((Object)current2.requiredExpansion).name : "base") }); } } finally { ((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } GenericStaticEnumerable allEquipment = EquipmentCatalog.allEquipment; AllEquipmentEnumerator enumerator3 = allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator3)).MoveNext()) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(((AllEquipmentEnumerator)(ref enumerator3)).Current); catalog.definitions.Add(new Row { stableName = ((Object)equipmentDef).name, displayName = Language.GetString(equipmentDef.nameToken), kind = ((Object.op_Implicit((Object)(object)equipmentDef.passiveBuffDef) && equipmentDef.passiveBuffDef.isElite) ? "aspect" : "equipment"), owner = Owner((Object)(object)equipmentDef), expansion = (Object.op_Implicit((Object)(object)equipmentDef.requiredExpansion) ? ((Object)equipmentDef.requiredExpansion).name : "base") }); } } finally { ((IDisposable)(*(AllEquipmentEnumerator*)(&enumerator3))/*cast due to .constrained prefix*/).Dispose(); } Assembly assembly = typeof(CharacterBody).Assembly; string[] array = new string[2] { "RoR2.KeyItemCatalog", "RoR2.CursedBookSpellCatalog" }; foreach (string text in array) { Type type = assembly.GetType(text); if (type == null) { continue; } FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!fieldInfo.FieldType.IsArray || !typeof(ScriptableObject).IsAssignableFrom(fieldInfo.FieldType.GetElementType()) || !(fieldInfo.GetValue(null) is Array array2)) { continue; } foreach (ScriptableObject item in array2) { ScriptableObject val = item; if (!Object.op_Implicit((Object)(object)val)) { continue; } bool flag = false; foreach (Row definition in catalog.definitions) { if (definition.kind == text && definition.stableName == ((Object)val).name) { flag = true; } } if (!flag) { catalog.definitions.Add(new Row { stableName = ((Object)val).name, displayName = ((Object)val).name, kind = text, owner = Owner((Object)(object)val) }); } } } } string text2 = Path.Combine(Paths.ConfigPath, "TimpanistRuntimeCatalog.json"); File.WriteAllText(text2, JsonUtility.ToJson((object)catalog, true)); Plugin.Log("Runtime catalog written: " + text2 + "; tests NOT RUN"); } catch (Exception ex) { Plugin.Log("Catalog audit failed: " + ex); } } } public static class SkillIcons { public static Sprite Load(string id) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_007c: 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) string text = Presentation.AssetPath("icons/" + id.ToLowerInvariant() + ".png"); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text))) { throw new InvalidDataException("Timpanist skill icon: " + text); } ((Object)val).name = "Timpanist_" + id; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } public sealed class DrumSkillDef : SkillDef { public override bool CanExecute(GenericSkill slot) { TimpanistController component = ((Component)slot).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !component.InputAllowed() || component.Weapon.state is RollState) { return false; } if (component.Cavalry.state is ChargeState chargeState && !CavalryRules.ChargeCancel(((ButtonState)(ref ((Component)slot).GetComponent().skill1)).justPressed, chargeState.Age)) { return false; } return ((SkillDef)this).CanExecute(slot); } protected override EntityState InstantiateNextState(GenericSkill slot) { TimpanistController component = ((Component)slot).GetComponent(); StrokeState obj = new StrokeState { right = component.NextRight, mode = Tuning.Mid, attackSpeed = Rules.Speed(component.Body.attackSpeed), castId = component.NextCast() }; ((BaseSkillState)obj).activatorSkillSlot = slot; return (EntityState)(object)obj; } public override void OnExecute(GenericSkill slot) { ((SkillDef)this).OnExecute(slot); TimpanistController component = ((Component)slot).GetComponent(); component.NextRight = !component.NextRight; component.CancelCharge(); } } public sealed class RollSkillDef : SkillDef { public override bool CanExecute(GenericSkill slot) { TimpanistController component = ((Component)slot).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.InputAllowed() && !(component.Cavalry.state is ChargeState) && !(component.Weapon.state is RollState)) { return ((SkillDef)this).CanExecute(slot); } return false; } } public sealed class TimpanistMain : GenericCharacterMain { private TimpanistController c; public override void OnEnter() { ((GenericCharacterMain)this).OnEnter(); c = ((EntityState)this).GetComponent(); } protected override bool CanExecuteSkill(GenericSkill skill) { if (!Object.op_Implicit((Object)(object)c) || c.InputAllowed()) { return ((GenericCharacterMain)this).CanExecuteSkill(skill); } return false; } public override void FixedUpdate() { ((GenericCharacterMain)this).FixedUpdate(); if (Object.op_Implicit((Object)(object)c)) { c.PrimaryPressed = false; } } } public sealed class SonicBurst : MonoBehaviour { private Mesh mesh; private Material material; private float age; private readonly Vector3[] v = (Vector3[])(object)new Vector3[48]; private readonly int[] ix = new int[192]; public static void AtDrum(CharacterBody body, bool right, Tuning pitch) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform) || !Object.op_Implicit((Object)(object)PressureVisual.Template)) { return; } Transform val = null; Transform[] componentsInChildren = ((Component)body.modelLocator.modelTransform).GetComponentsInChildren(); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name == (right ? "HeadStrikeR" : "HeadStrikeL")) { val = val2; break; } } if (!Object.op_Implicit((Object)(object)val)) { return; } GameObject val3 = new GameObject("TimpanistContactParticles"); val3.transform.position = val.position; SonicBurst sonicBurst = val3.AddComponent(); sonicBurst.material = PressureVisual.CreateMaterial(PressureVisual.ColorFor(pitch)); sonicBurst.mesh = new Mesh { name = "TimpanistContactDiamonds" }; val3.AddComponent().sharedMesh = sonicBurst.mesh; ((Renderer)val3.AddComponent()).sharedMaterial = sonicBurst.material; int[] array = new int[24] { 0, 2, 4, 2, 1, 4, 1, 3, 4, 3, 0, 4, 2, 0, 5, 1, 2, 5, 3, 1, 5, 0, 3, 5 }; for (int j = 0; j < 8; j++) { for (int k = 0; k < 24; k++) { sonicBurst.ix[j * 24 + k] = array[k] + j * 6; } } sonicBurst.Draw(); } private void Update() { age += Time.deltaTime; if (age > 0.24f) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Draw(); } } private void Draw() { //IL_0065: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); for (int i = 0; i < 8; i++) { float num = (float)i * (float)Math.PI / 4f; ((Vector3)(ref val))..ctor(Mathf.Cos(num) * age, age * 0.7f, Mathf.Sin(num) * age); float num2 = 0.04f * (1f - age / 0.24f); v[i * 6] = val + Vector3.right * num2; v[i * 6 + 1] = val - Vector3.right * num2; v[i * 6 + 2] = val + Vector3.up * num2; v[i * 6 + 3] = val - Vector3.up * num2; v[i * 6 + 4] = val + Vector3.forward * num2; v[i * 6 + 5] = val - Vector3.forward * num2; } mesh.vertices = v; mesh.triangles = ix; mesh.RecalculateNormals(); mesh.RecalculateBounds(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } } } public sealed class StrokeState : BaseSkillState { public bool right; public Tuning mode = Tuning.Mid; public float attackSpeed = 1f; public int castId; private bool fired; private TimpanistController c; public override void OnEnter() { ((BaseState)this).OnEnter(); c = ((EntityState)this).GetComponent(); c.VisualMask = 0; c.StrokeSpeed = attackSpeed; if (right) { c.RightFlash = Time.time; } else { c.LeftFlash = Time.time; } ((BaseState)this).StartAimMode(2f, false); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!fired && ((EntityState)this).fixedAge >= CavalryRules.ContactTime(attackSpeed)) { fired = true; if (c.InputAllowed()) { if (NetworkServer.active) { Combat.Strike(((EntityState)this).characterBody, mode, right); } try { PresentationAudio.Strike(((EntityState)this).characterBody, right); PressureVisual.Emit(((EntityState)this).characterBody, Tuning.Mid, 22f, primary: true); SonicBurst.AtDrum(((EntityState)this).characterBody, right, Tuning.Mid); } catch (Exception ex) { Plugin.Log("Strike presentation: " + ex.Message); } if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-1.2f, -0.6f, -0.3f, 0.3f); } } } if (((EntityState)this).isAuthority && (!c.InputAllowed() || ((EntityState)this).fixedAge >= CavalryRules.StrikeDuration(attackSpeed))) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } public override void OnSerialize(NetworkWriter w) { ((BaseSkillState)this).OnSerialize(w); w.Write(right); w.Write(attackSpeed); w.Write(castId); } public override void OnDeserialize(NetworkReader r) { ((BaseSkillState)this).OnDeserialize(r); right = r.ReadBoolean(); attackSpeed = r.ReadSingle(); castId = r.ReadInt32(); } } public sealed class RollState : BaseSkillState { private TimpanistController c; private float visualTick; public override void OnEnter() { ((BaseState)this).OnEnter(); c = ((EntityState)this).GetComponent(); c.VisualMask = 1; c.RollClock = Time.time; ((BaseState)this).StartAimMode(2f, false); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); bool flag = !c.InputAllowed() || (Object)(object)((EntityState)this).skillLocator.secondary.skillDef != (Object)(object)Content.Right || ((EntityState)this).fixedAge >= 2f; if (((EntityState)this).isAuthority && (!((EntityState)this).inputBank.skill2.down || flag)) { ((EntityState)this).outer.SetNextStateToMain(); return; } if (flag) { c.VisualMask = 0; return; } c.VisualMask = 1; if (NetworkServer.active && Time.fixedTime >= c.NextEffectTick) { c.NextEffectTick = Time.fixedTime + 0.2f; Combat.Roll(((EntityState)this).characterBody); } visualTick -= Time.fixedDeltaTime; if (visualTick <= 0f) { visualTick += 0.25f; PressureVisual.Emit(((EntityState)this).characterBody, Tuning.Low, 14f); } } public override void OnExit() { if (Object.op_Implicit((Object)(object)c)) { c.VisualMask = 0; } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public sealed class GrandAccentState : BaseSkillState { private TimpanistController c; private float speed; private bool fired; public override void OnEnter() { ((BaseState)this).OnEnter(); c = ((EntityState)this).GetComponent(); c.CancelCharge(); c.VisualMask = 0; speed = Rules.Speed(((EntityState)this).characterBody.attackSpeed); c.StrokeSpeed = speed; c.LeftFlash = (c.RightFlash = (c.GrandFlash = Time.time)); ((BaseState)this).StartAimMode(2f, false); } public override void FixedUpdate() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) ((EntityState)this).FixedUpdate(); if (!fired && ((EntityState)this).fixedAge >= CavalryRules.ContactTime(speed)) { fired = true; if (c.InputAllowed()) { Ray val = Combat.Aim(((EntityState)this).characterBody); if (NetworkServer.active) { Combat.Area(((EntityState)this).characterBody, ((Ray)(ref val)).origin, ((Ray)(ref val)).direction, 25f, 55f, 9f, 1f, (DamageSource)8, ((EntityState)this).characterBody.RollCrit(), stun: true, new HashSet()); ImpactVisual.Emit(((EntityState)this).characterBody, ((Ray)(ref val)).origin, ((Ray)(ref val)).direction, 25f, ImpactKind.Grand); } PresentationAudio.Strike(((EntityState)this).characterBody, right: false, 0.85f); PresentationAudio.Strike(((EntityState)this).characterBody, right: true, 0.85f); SonicBurst.AtDrum(((EntityState)this).characterBody, right: false, Tuning.High); SonicBurst.AtDrum(((EntityState)this).characterBody, right: true, Tuning.High); if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-2.2f, -1.4f, -0.5f, 0.5f); } } } if (((EntityState)this).isAuthority && (!c.InputAllowed() || ((EntityState)this).fixedAge >= Mathf.Max(0.22f, 0.8f / speed))) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public sealed class ChargeState : BaseSkillState { private Vector3 direction; private Vector3 previous; private Vector3 lastCenter; private bool stopped; private bool crit; private float visualTick; private TimpanistController c; private readonly HashSet hit = new HashSet(); private readonly HashSet afterbeatHits = new HashSet(); public float Age => ((EntityState)this).fixedAge; public override void OnEnter() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); c = ((EntityState)this).GetComponent(); c.CancelRoll("charge"); if (((EntityState)this).isAuthority && !(c.Weapon.state is Idle)) { c.Weapon.SetNextStateToMain(); } previous = ((EntityState)this).characterBody.footPosition + Vector3.up * 1.1f; lastCenter = previous; if (((Vector3)(ref direction)).sqrMagnitude < 0.1f) { Vector3 val = Vector3.ProjectOnPlane((((Vector3)(ref ((EntityState)this).inputBank.moveVector)).sqrMagnitude > 0.01f) ? ((EntityState)this).inputBank.moveVector : ((EntityState)this).inputBank.aimDirection, Vector3.up); direction = ((Vector3)(ref val)).normalized; } if (((Vector3)(ref direction)).sqrMagnitude < 0.1f) { direction = ((EntityState)this).transform.forward; } previous += direction * 1.7f; crit = ((EntityState)this).characterBody.RollCrit(); c.GrantPoise(1f, charge: true); c.ChargeFlash = Time.time; PresentationAudio.Strike(((EntityState)this).characterBody, right: false, 0.45f); } public override void FixedUpdate() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); Vector3 val = ((EntityState)this).characterBody.footPosition + Vector3.up * 1.1f; if (!((EntityState)this).isAuthority) { Vector3 val2 = Vector3.ProjectOnPlane(val - lastCenter, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f && ((Vector3)(ref val2)).sqrMagnitude < 64f) { direction = ((Vector3)(ref val2)).normalized; } } lastCenter = val; Vector3 val3 = val + direction * 1.7f; if (NetworkServer.active) { if (Vector3.Distance(previous, val3) < 8f) { Combat.Sweep(((EntityState)this).characterBody, previous, val3, 1.4f, 3.5f, 1f, crit, hit, afterbeatHits); } previous = val3; } visualTick -= Time.fixedDeltaTime; if (visualTick <= 0f) { visualTick = 0.1f; ImpactVisual.LocalLance(((EntityState)this).characterBody, direction); } if (!((EntityState)this).isAuthority) { return; } if (((EntityState)this).fixedAge >= 1f || !c.InputAllowed() || (Object)(object)((EntityState)this).skillLocator.utility.skillDef != (Object)(object)Content.Charge) { ((EntityState)this).outer.SetNextStateToMain(); return; } Vector3 val4 = Vector3.ProjectOnPlane(((EntityState)this).inputBank.moveVector, Vector3.up); if (((Vector3)(ref val4)).sqrMagnitude > 0.01f) { direction = Vector3.RotateTowards(direction, ((Vector3)(ref val4)).normalized, (float)Math.PI * 19f / 36f * Time.fixedDeltaTime, 0f); } float num = CavalryRules.ChargeSpeed(((EntityState)this).characterBody.moveSpeed / (((EntityState)this).characterBody.isSprinting ? ((EntityState)this).characterBody.sprintingSpeedMultiplier : 1f), ((EntityState)this).fixedAge); Vector3 footPosition = ((EntityState)this).characterBody.footPosition; Vector3 val5 = footPosition + Vector3.up * 0.5f; Vector3 val6 = footPosition + Vector3.up * 1.7f; Vector3 val7 = direction; float num2 = num * Time.fixedDeltaTime; LayerIndex world = LayerIndex.world; RaycastHit val8 = default(RaycastHit); if (Physics.CapsuleCast(val5, val6, 0.48f, val7, ref val8, num2, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1) && Vector3.Dot(((RaycastHit)(ref val8)).normal, Vector3.up) < 0.5f) { stopped = true; ((EntityState)this).outer.SetNextStateToMain(); return; } ((EntityState)this).characterMotor.velocity = new Vector3(direction.x * num, ((EntityState)this).characterMotor.velocity.y, direction.z * num); ((EntityState)this).characterMotor.moveDirection = direction; if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterDirection.forward = direction; } } public override void OnExit() { //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) c.EndChargePoise(); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { float num = (stopped ? 0f : ((EntityState)this).characterBody.moveSpeed); ((EntityState)this).characterMotor.velocity = new Vector3(direction.x * num, ((EntityState)this).characterMotor.velocity.y, direction.z * num); } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } public override void OnSerialize(NetworkWriter w) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnSerialize(w); w.Write(direction); } public override void OnDeserialize(NetworkReader r) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnDeserialize(r); direction = r.ReadVector3(); } } public static class SurvivorIdentity { private static Texture2D portrait; public const string Lore = "UES SAFE TRAVELS\nCargo Exception 04-117\n\nThe manifest listed two percussion instruments, one suit of protective equipment, and one passenger.\n\nI counted two passengers.\n\nThe smaller one stood beside the loading ramp with a helmet under one arm. The larger one was eating the corner of the manifest. Copper drums hung on either side of its saddle, polished everywhere a hand could reach. The armor had been repaired with fasteners that did not match.\n\nI explained that we had no provision for livestock.\n\n\"Neither did the last ship.\"\n\nI asked what had happened to the last ship. The passenger took the paper out of the animal's mouth and smoothed it against a drumhead.\n\n\"Where do you want us?\"\n\nThey were assigned an empty freight pen pending review. That evening, security requested a demonstration of the equipment. I attended because the damage, if any, would come out of my allocation.\n\nOne mallet rose. The blow was almost gentle.\n\nThe sound went through my boots. A rack of empty containers slid backward until its restraints caught. The security officer opened his mouth.\n\nThen the restraints snapped.\n\nThe mallet was already resting on the drum.\n\nOur visitor steadied the horse with a hand on its neck. It had not moved.\n\nI amended the cargo classification. Before I left, I asked why they had brought the polished armor. There was nothing ceremonial about this assignment.\n\n\"There might be, when we bring them home.\"\n\nAdditional requisition: feed, sixteen sacks.\nCharge to personnel."; public static void RegisterLanguage() { LanguageAPI.Add("TIMPANIST_LORE", "UES SAFE TRAVELS\nCargo Exception 04-117\n\nThe manifest listed two percussion instruments, one suit of protective equipment, and one passenger.\n\nI counted two passengers.\n\nThe smaller one stood beside the loading ramp with a helmet under one arm. The larger one was eating the corner of the manifest. Copper drums hung on either side of its saddle, polished everywhere a hand could reach. The armor had been repaired with fasteners that did not match.\n\nI explained that we had no provision for livestock.\n\n\"Neither did the last ship.\"\n\nI asked what had happened to the last ship. The passenger took the paper out of the animal's mouth and smoothed it against a drumhead.\n\n\"Where do you want us?\"\n\nThey were assigned an empty freight pen pending review. That evening, security requested a demonstration of the equipment. I attended because the damage, if any, would come out of my allocation.\n\nOne mallet rose. The blow was almost gentle.\n\nThe sound went through my boots. A rack of empty containers slid backward until its restraints caught. The security officer opened his mouth.\n\nThen the restraints snapped.\n\nThe mallet was already resting on the drum.\n\nOur visitor steadied the horse with a hand on its neck. It had not moved.\n\nI amended the cargo classification. Before I left, I asked why they had brought the polished armor. There was nothing ceremonial about this assignment.\n\n\"There might be, when we bring them home.\"\n\nAdditional requisition: feed, sixteen sacks.\nCharge to personnel."); } public static Texture2D LoadPortrait() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)portrait)) { return portrait; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); string text = Presentation.AssetPath("icons/survivor.png"); try { if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text))) { throw new InvalidDataException("Timpanist survivor portrait: " + text); } ((Object)val).name = "TimpanistSurvivorPortrait"; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; portrait = val; return portrait; } catch { Object.Destroy((Object)(object)val); throw; } } }