Decompiled source of Jak3Guns v0.1.0
Jak3Guns.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OtherLoader; using UnityEngine; using UnityEngine.Audio; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Jak3Guns { public class JakArcWhip : JakProjectile { [Header("Whip")] public int Points = 12; public float Length = 8f; [Tooltip("How quickly each point catches up with the barrel: the base snappy, the tip lagging.")] public float BaseFollow = 30f; public float TipFollow = 6f; public float Sway = 0.25f; public float TouchRadius = 0.5f; public float TipReach = 3.5f; public LayerMask HitMask; [Tooltip("What the whip can't pass and its arcs can't see through (walls, the ground).")] public LayerMask WallMask; [Header("Damage")] public float JakDamage = 2f; public float HitEvery = 0.4f; public float PushSpeed = 1f; [Tooltip("A round from the canister this often while it runs.")] public float DrainEvery = 0.2f; [Header("Look")] public LineRenderer Whip; [Tooltip("A soft glow along the whip under the lightning (play-tested: the lightning alone barely showed).")] public LineRenderer Glow; public Light TipLight; public float Rejitter = 0.05f; public float Jitter = 0.12f; public JakLightning ArcPrefab; public AudioSource Loop; private JakGun m_gun; private Transform m_muzzle; private Rigidbody m_own; private int m_iff; private Vector3[] m_points; private Vector3[] m_drawn; private float m_age; private float m_nextJitter; private float m_nextDrain; private float m_nextScan; private readonly Dictionary<object, float> m_lastHit = new Dictionary<object, float>(); public override void Launch(JakGun gun, Transform muzzle) { //IL_0061: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_0091: Unknown result type (might be due to invalid IL or missing references) m_gun = gun; m_muzzle = muzzle; m_own = ((FVRPhysicalObject)gun).RootRigidbody; m_iff = GM.CurrentPlayerBody.GetPlayerIFF(); m_points = (Vector3[])(object)new Vector3[Points]; m_drawn = (Vector3[])(object)new Vector3[Points]; for (int i = 0; i < Points; i++) { ref Vector3 reference = ref m_points[i]; reference = muzzle.position + muzzle.forward * Length * (float)i / (float)(Points - 1); } if ((Object)(object)Whip != (Object)null) { Whip.useWorldSpace = true; Whip.positionCount = Points; } if ((Object)(object)Glow != (Object)null) { Glow.useWorldSpace = true; Glow.positionCount = Points; } m_nextDrain = DrainEvery; if ((Object)(object)Loop != (Object)null) { Loop.Play(); } } private void LateUpdate() { //IL_00bd: 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_00d2: 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_00de: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) if (m_points == null) { return; } float deltaTime = Time.deltaTime; m_age += deltaTime; bool flag = (Object)(object)m_gun != (Object)null && ((FVRInteractiveObject)m_gun).IsHeld && m_gun.TriggerHeld && (Object)(object)m_muzzle != (Object)null; if (flag && m_age >= m_nextDrain) { m_nextDrain += DrainEvery; flag = m_gun.TakeAmmo(1); } if (!flag) { Stop(); return; } ((Component)this).transform.position = m_muzzle.position; Vector3 forward = m_muzzle.forward; Vector3 up = m_muzzle.up; Vector3 right = m_muzzle.right; for (int i = 0; i < Points; i++) { float num = (float)i / (float)(Points - 1); Vector3 val = m_muzzle.position + forward * Length * num + (right * Mathf.Sin(m_age * 6f + num * 4f) + up * Mathf.Cos(m_age * 5f + num * 3f)) * Sway * num; float num2 = Mathf.Lerp(BaseFollow, TipFollow, num); ref Vector3 reference = ref m_points[i]; reference = ((i != 0) ? Vector3.Lerp(m_points[i], val, 1f - Mathf.Exp((0f - num2) * deltaTime)) : m_muzzle.position); } StopAtWalls(); if (m_age >= m_nextJitter) { m_nextJitter = m_age + Rejitter; for (int j = 0; j < Points; j++) { Vector3 val2 = ((j != 0) ? (Random.insideUnitSphere * Jitter) : Vector3.zero); m_drawn[j] = val2; } } if ((Object)(object)Whip != (Object)null) { for (int k = 0; k < Points; k++) { Whip.SetPosition(k, m_points[k] + m_drawn[k]); } } if ((Object)(object)Glow != (Object)null) { for (int l = 0; l < Points; l++) { Glow.SetPosition(l, m_points[l]); } } if ((Object)(object)TipLight != (Object)null) { ((Component)TipLight).transform.position = m_points[Points - 1]; TipLight.intensity = 2f + Random.value; } if (m_age >= m_nextScan) { m_nextScan = m_age + 0.1f; Scan(); } } private void StopAtWalls() { //IL_0015: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_005b: 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_0085: 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_0096: 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_00a0: 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_00b9: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i < Points; i++) { Vector3 val = m_points[i] - m_points[i - 1]; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude < 0.0001f) && JakTargets.Probe(m_points[i - 1], val / magnitude, magnitude, LayerMask.op_Implicit(WallMask), m_own, out var best)) { Vector3 val2 = ((RaycastHit)(ref best)).point + ((RaycastHit)(ref best)).normal * 0.05f; for (int j = i; j < Points; j++) { m_points[j] = val2; } break; } } } private void Scan() { //IL_001c: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) Dictionary<object, JakTarget> dictionary = new Dictionary<object, JakTarget>(); for (int i = 1; i < Points; i++) { foreach (JakTarget item in JakTargets.InSphere(m_points[i], TouchRadius, LayerMask.op_Implicit(HitMask), m_own)) { if ((Object)(object)item.Aim != (Object)null && JakTargets.InSight(m_points[i], item.Aim.position, LayerMask.op_Implicit(WallMask), m_own)) { dictionary[item.Key] = item; } } } Vector3 val = m_points[Points - 1]; foreach (JakTarget item2 in JakTargets.InSphere(val, TipReach, LayerMask.op_Implicit(HitMask), m_own)) { if (!((Object)(object)item2.Aim == (Object)null) && !dictionary.ContainsKey(item2.Key) && JakTargets.InSight(val, item2.Aim.position, LayerMask.op_Implicit(WallMask), m_own)) { if ((Object)(object)ArcPrefab != (Object)null && (!m_lastHit.TryGetValue(item2.Key, out var value) || m_age - value >= HitEvery)) { JakLightning jakLightning = Object.Instantiate<JakLightning>(ArcPrefab, item2.Aim.position, Quaternion.identity); jakLightning.Strike(null, val, item2.Aim, item2.Aim.position); } dictionary[item2.Key] = item2; } } foreach (KeyValuePair<object, JakTarget> item3 in dictionary) { if (!m_lastHit.TryGetValue(item3.Key, out var value2) || !(m_age - value2 < HitEvery)) { JakTarget value3 = item3.Value; if (!((Object)(object)value3.Collider == (Object)null) && !((Object)(object)value3.Aim == (Object)null)) { m_lastHit[item3.Key] = m_age; Vector3 val2 = value3.Aim.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; Jak3Guns.JakDamage.Hit(value3.Collider, JakDamage, value3.Aim.position, normalized, -normalized, m_iff, ((Component)this).transform.position, PushSpeed); } } } if (dictionary.Count > 0 && (Object)(object)m_gun != (Object)null && (Object)(object)((FVRInteractiveObject)m_gun).m_hand != (Object)null) { ((FVRInteractiveObject)m_gun).m_hand.Buzz(((FVRInteractiveObject)m_gun).m_hand.Buzzer.Buzz_GunShot); } } private void Stop() { if ((Object)(object)m_gun != (Object)null) { m_gun.EndCharge(this); } m_points = null; if ((Object)(object)Loop != (Object)null) { Loop.Stop(); } Object.Destroy((Object)(object)((Component)this).gameObject); } } public static class JakDamage { public const float JakToBlunt = 420f; public static IFVRDamageable FindDamageable(Collider col) { Component component = ((Component)col).gameObject.GetComponent(typeof(IFVRDamageable)); IFVRDamageable val = (IFVRDamageable)(object)((component is IFVRDamageable) ? component : null); if (val == null && (Object)(object)col.attachedRigidbody != (Object)null) { Component component2 = ((Component)col.attachedRigidbody).gameObject.GetComponent(typeof(IFVRDamageable)); val = (IFVRDamageable)(object)((component2 is IFVRDamageable) ? component2 : null); } return val; } public static bool Hit(Collider col, float jakDamage, Vector3 point, Vector3 dir, Vector3 normal, int iff, Vector3 source, float pushSpeed, float armorPierce = 0f) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0056: 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) bool result = false; IFVRDamageable val = FindDamageable(col); if (val != null) { float num = jakDamage * 420f; SosigWearable val2 = (SosigWearable)(object)((val is SosigWearable) ? val : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.L != (Object)null && armorPierce > 0f) { val2.L.Damage(Make(num * armorPierce, point, dir, normal, iff, source)); num *= 1f - armorPierce; } val.Damage(Make(num, point, dir, normal, iff, source)); result = true; } Rigidbody attachedRigidbody = col.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic && pushSpeed > 0f) { attachedRigidbody.AddForceAtPosition(dir * pushSpeed, point, (ForceMode)2); } return result; } private static Damage Make(float blunt, Vector3 point, Vector3 dir, Vector3 normal, int iff, Vector3 source) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Damage val = new Damage(); val.Class = (DamageClass)1; val.point = point; val.hitNormal = normal; val.strikeDir = dir; val.damageSize = 0.05f; val.Source_IFF = iff; val.Source_Point = source; val.Dam_Blunt = blunt; val.Dam_TotalKinetic = blunt; return val; } } public class JakDarkShot : JakProjectile { private enum Phase { Charging, Flying, Blast } [Header("Charge")] public float MinCharge = 0.3f; public float GrowTime = 0.2f; [Header("Flight")] [Tooltip("Metres per second. Jak's is 108 (1.8 m a frame); play-tested twice as too fast.")] public float Speed = 35f; [Tooltip("Seconds before it bursts in the air (Jak: 1.5 s at its 108 m/s; longer here at the slower speed).")] public float Lifetime = 3f; public float CastRadius = 0.25f; public LayerMask HitMask; [Tooltip("Degrees per second the ball circles its line of flight.")] public float SpinRate = 660f; [Tooltip("The circle opens to SpinRadius over SpinOpenTime, then tightens to SpinRadiusEnd by the end.")] public float SpinRadius = 0.5f; public float SpinRadiusEnd = 0.15f; public float SpinOpenTime = 0.3f; [Header("Blast")] public float BlastRadius = 10f; public int MaxTargets = 16; public float JakDamage = 16f; public float ChainDelay = 0.1f; public float HitDelay = 0.1f; public float PushSpeed = 6f; [Header("Look")] [Tooltip("The ball's glows and sparks; scaled with the charge.")] public Transform Ball; public Light BallLight; public JakLoopSound ChargeAudio; public AudioSource FireAudio; public AudioSource TrailAudio; public GameObject ExplosionPrefab; public JakLightning LightningPrefab; private Phase m_phase; private JakGun m_gun; private Transform m_muzzle; private Rigidbody m_own; private int m_iff; private float m_age; private float m_lightFull; private Vector3 m_core; private Vector3 m_dir; private Vector3 m_perp; private float m_spinAngle; private Vector3 m_blastPoint; private List<JakTarget> m_targets; private int m_next; private float m_chainTimer; private readonly List<KeyValuePair<float, JakTarget>> m_pending = new List<KeyValuePair<float, JakTarget>>(); public override void Launch(JakGun gun, Transform muzzle) { m_gun = gun; m_muzzle = muzzle; m_own = ((FVRPhysicalObject)gun).RootRigidbody; m_iff = GM.CurrentPlayerBody.GetPlayerIFF(); m_phase = Phase.Charging; m_age = 0f; if ((Object)(object)BallLight != (Object)null) { m_lightFull = BallLight.intensity; } if ((Object)(object)ChargeAudio != (Object)null) { ChargeAudio.Play(); } Follow(); SetSize(0f); } private void LateUpdate() { float deltaTime = Time.deltaTime; m_age += deltaTime; switch (m_phase) { case Phase.Charging: { Follow(); SetSize((!(GrowTime > 0f)) ? 1f : Mathf.Clamp01(m_age / GrowTime)); bool flag = (Object)(object)m_gun != (Object)null && ((FVRInteractiveObject)m_gun).IsHeld && m_gun.TriggerHeld; if (m_age >= MinCharge && !flag) { Release(); } break; } case Phase.Flying: Fly(deltaTime); break; case Phase.Blast: Chain(deltaTime); break; } } private void Follow() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_muzzle == (Object)null)) { ((Component)this).transform.position = m_muzzle.position; ((Component)this).transform.rotation = m_muzzle.rotation; } } private void SetSize(float t) { //IL_0018: 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) if ((Object)(object)Ball != (Object)null) { Ball.localScale = Vector3.one * Mathf.Max(t, 0.01f); } if ((Object)(object)BallLight != (Object)null) { BallLight.intensity = m_lightFull * t; } } private void Release() { //IL_0079: 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_00ab: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) m_phase = Phase.Flying; m_age = 0f; SetSize(1f); if ((Object)(object)ChargeAudio != (Object)null) { ChargeAudio.Stop(); } if ((Object)(object)FireAudio != (Object)null) { FireAudio.Play(); } if ((Object)(object)TrailAudio != (Object)null) { TrailAudio.Play(); } m_core = ((Component)this).transform.position; m_dir = ((!((Object)(object)m_muzzle != (Object)null)) ? ((Component)this).transform.forward : m_muzzle.forward); m_perp = Vector3.Cross(m_dir, Vector3.up); if (((Vector3)(ref m_perp)).sqrMagnitude < 0.0001f) { m_perp = Vector3.Cross(m_dir, Vector3.right); } ((Vector3)(ref m_perp)).Normalize(); if ((Object)(object)m_gun != (Object)null) { m_gun.Discharge(); m_gun.EndCharge(this); } } private void Fly(float dt) { //IL_002b: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_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_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_010c: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: 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_012f: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_022b: 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_0248: Unknown result type (might be due to invalid IL or missing references) if (m_age >= Lifetime) { Burst(((Component)this).transform.position); return; } m_core += m_dir * Speed * dt; m_spinAngle += SpinRate * dt; float num = ((!(m_age < SpinOpenTime)) ? Mathf.Lerp(SpinRadius, SpinRadiusEnd, (m_age - SpinOpenTime) / Mathf.Max(Lifetime - SpinOpenTime, 0.01f)) : Mathf.Lerp(0f, SpinRadius, m_age / SpinOpenTime)); Vector3 val = m_core + Quaternion.AngleAxis(m_spinAngle, m_dir) * m_perp * num; Vector3 position = ((Component)this).transform.position; Vector3 val2 = val - position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 1E-05f) { RaycastHit[] array = Physics.SphereCastAll(position, CastRadius, val2 / magnitude, magnitude, LayerMask.op_Implicit(HitMask), (QueryTriggerInteraction)1); FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody; float num2 = float.MaxValue; Vector3 point = Vector3.zero; for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if ((!((Object)(object)m_own != (Object)null) || !((Object)(object)collider.attachedRigidbody == (Object)(object)m_own)) && (!((Object)(object)currentPlayerBody != (Object)null) || !((Component)collider).transform.IsChildOf(((Component)currentPlayerBody).transform)) && ((RaycastHit)(ref array[i])).distance < num2) { num2 = ((RaycastHit)(ref array[i])).distance; point = ((!(((RaycastHit)(ref array[i])).point == Vector3.zero)) ? ((RaycastHit)(ref array[i])).point : (position + val2 / magnitude * ((RaycastHit)(ref array[i])).distance)); } } if (num2 < float.MaxValue) { Burst(point); return; } } ((Component)this).transform.position = val; ((Component)this).transform.rotation = Quaternion.LookRotation(m_dir); } private void Burst(Vector3 point) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_008e: 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) m_phase = Phase.Blast; m_blastPoint = point; ((Component)this).transform.position = point; if ((Object)(object)TrailAudio != (Object)null) { TrailAudio.Stop(); } if ((Object)(object)Ball != (Object)null) { ((Component)Ball).gameObject.SetActive(false); } if ((Object)(object)BallLight != (Object)null) { ((Behaviour)BallLight).enabled = false; } if ((Object)(object)ExplosionPrefab != (Object)null) { Object.Instantiate<GameObject>(ExplosionPrefab, point, Quaternion.identity); } GM.CurrentSceneSettings.PingReceivers(point); m_targets = JakTargets.InSphere(point, BlastRadius, LayerMask.op_Implicit(HitMask), m_own); if (m_targets.Count > MaxTargets) { m_targets.RemoveRange(MaxTargets, m_targets.Count - MaxTargets); } if (m_targets.Count == 0) { Object.Destroy((Object)(object)((Component)this).gameObject, 2f); return; } JakTarget jakTarget = m_targets[0]; Arc(null, point, jakTarget); Hit(jakTarget); m_next = m_targets.Count - 1; m_chainTimer = 0f; } private void Chain(float dt) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (m_targets == null) { return; } m_chainTimer += dt; while (m_next >= 1 && m_chainTimer >= ChainDelay) { m_chainTimer -= ChainDelay; JakTarget jakTarget = m_targets[m_next--]; if (!((Object)(object)jakTarget.Collider == (Object)null)) { Arc(m_targets[0].Aim, m_blastPoint, jakTarget); m_pending.Add(new KeyValuePair<float, JakTarget>(m_age + HitDelay, jakTarget)); } } for (int num = m_pending.Count - 1; num >= 0; num--) { if (!(m_age < m_pending[num].Key)) { Hit(m_pending[num].Value); m_pending.RemoveAt(num); } } if (m_next < 1 && m_pending.Count == 0) { m_targets = null; Object.Destroy((Object)(object)((Component)this).gameObject, 2f); } } private void Arc(Transform from, Vector3 fromPos, JakTarget to) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)LightningPrefab == (Object)null) && !((Object)(object)to.Aim == (Object)null)) { JakLightning jakLightning = Object.Instantiate<JakLightning>(LightningPrefab, to.Aim.position, Quaternion.identity); jakLightning.Strike(from, fromPos, to.Aim, to.Aim.position); } } private void Hit(JakTarget t) { //IL_0047: 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_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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)t.Collider == (Object)null)) { Vector3 val = ((!((Object)(object)t.Aim != (Object)null)) ? ((Component)t.Collider).transform.position : t.Aim.position); Vector3 val2 = val - m_blastPoint; val2 = ((!(((Vector3)(ref val2)).sqrMagnitude > 0.0001f)) ? Vector3.up : ((Vector3)(ref val2)).normalized); Vector3 val3 = val2 + Vector3.up * 0.5f; Vector3 normalized = ((Vector3)(ref val3)).normalized; Jak3Guns.JakDamage.Hit(t.Collider, JakDamage, val, normalized, -val2, m_iff, m_blastPoint, PushSpeed); } } } public class JakGravityWave : JakProjectile { private class Floater { public Sosig Sosig; public Rigidbody[] Bodies; public Collider Collider; public Transform Aim; public Vector3 Spin; } [Header("Wave")] public float MaxRadius = 30f; public float ExpandTime = 1.2f; public float Ahead = 1.5f; [Tooltip("Height above and below the ring that it reaches.")] public float Reach = 3f; public LayerMask HitMask; public LayerMask GroundMask; [Header("Zero-g")] [Tooltip("Seconds aloft (play-tested: 8, up from 4).")] public float FloatTime = 8f; public float LiftSpeed = 1.2f; public float SpinSpeed = 1.5f; public float SlamSpeed = 9f; public float JakDamage = 4f; [Header("Look")] [Tooltip("Jak's gun-dark-2-ring model (1 m across at scale 1), scaled to the wave.")] public Transform Ring; public Renderer RingRenderer; private Rigidbody m_own; private int m_iff; private float m_age; private Vector3 m_origin; private readonly List<Floater> m_floaters = new List<Floater>(); private readonly HashSet<object> m_hit = new HashSet<object>(); private bool m_slammed; public override void Launch(JakGun gun, Transform muzzle) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c7: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) m_own = ((FVRPhysicalObject)gun).RootRigidbody; m_iff = GM.CurrentPlayerBody.GetPlayerIFF(); Vector3 forward = muzzle.forward; forward.y = 0f; Vector3 val = muzzle.position + ((!(((Vector3)(ref forward)).sqrMagnitude > 0.0001f)) ? Vector3.zero : ((Vector3)(ref forward)).normalized) * Ahead; m_origin = ((!JakTargets.Probe(val, Vector3.down, 4f, LayerMask.op_Implicit(GroundMask), m_own, out var best)) ? (val + Vector3.down * 1.2f) : (((RaycastHit)(ref best)).point + Vector3.up * 0.05f)); ((Component)this).transform.position = m_origin; ((Component)this).transform.rotation = Quaternion.identity; GM.CurrentSceneSettings.PingReceivers(m_origin); } private void Update() { //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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0159: 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_016c: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; m_age += deltaTime; float num = Mathf.Clamp01(m_age / ExpandTime); float num2 = MaxRadius * num; if ((Object)(object)Ring != (Object)null) { Ring.localScale = Vector3.one * Mathf.Max(num2, 0.01f); ((Component)Ring).gameObject.SetActive(num < 1f); } if (num < 1f) { Sweep(num2); } bool flag = m_age < ExpandTime + FloatTime; for (int i = 0; i < m_floaters.Count; i++) { Floater floater = m_floaters[i]; if ((Object)(object)floater.Sosig != (Object)null && flag) { floater.Sosig.m_unconsciousTime = Mathf.Max(floater.Sosig.m_unconsciousTime, 1f); } for (int j = 0; j < floater.Bodies.Length; j++) { Rigidbody val = floater.Bodies[j]; if (!((Object)(object)val == (Object)null) && flag) { val.useGravity = false; val.velocity = Vector3.Lerp(val.velocity, Vector3.up * LiftSpeed, 2f * deltaTime); val.angularVelocity = Vector3.Lerp(val.angularVelocity, floater.Spin, 2f * deltaTime); } } } if (!flag && !m_slammed) { Slam(); } if (m_slammed && m_age > ExpandTime + FloatTime + 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Sweep(float radius) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) foreach (JakTarget item in JakTargets.InSphere(m_origin, radius, LayerMask.op_Implicit(HitMask), m_own)) { if (m_hit.Contains(item.Key) || (Object)(object)item.Aim == (Object)null || Mathf.Abs(item.Aim.position.y - m_origin.y) > Reach) { continue; } m_hit.Add(item.Key); Floater floater = new Floater(); floater.Collider = item.Collider; floater.Aim = item.Aim; floater.Spin = Random.onUnitSphere * SpinSpeed; Floater floater2 = floater; ref Sosig sosig = ref floater2.Sosig; object key = item.Key; sosig = (Sosig)((key is Sosig) ? key : null); if ((Object)(object)floater2.Sosig != (Object)null) { floater2.Sosig.m_isUnconscious = true; floater2.Sosig.m_maxUnconsciousTime = Mathf.Max(floater2.Sosig.m_maxUnconsciousTime, FloatTime + 2f); floater2.Sosig.m_unconsciousTime = FloatTime + 1f; List<Rigidbody> list = new List<Rigidbody>(); foreach (SosigLink link in floater2.Sosig.Links) { if ((Object)(object)link != (Object)null && (Object)(object)link.R != (Object)null) { list.Add(link.R); } } floater2.Bodies = list.ToArray(); } else { Rigidbody attachedRigidbody = item.Collider.attachedRigidbody; floater2.Bodies = (Rigidbody[])(object)((!((Object)(object)attachedRigidbody != (Object)null) || attachedRigidbody.isKinematic) ? new Rigidbody[0] : new Rigidbody[1] { attachedRigidbody }); } m_floaters.Add(floater2); } } private void Slam() { //IL_0047: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) m_slammed = true; for (int i = 0; i < m_floaters.Count; i++) { Floater floater = m_floaters[i]; for (int j = 0; j < floater.Bodies.Length; j++) { Rigidbody val = floater.Bodies[j]; if (!((Object)(object)val == (Object)null)) { val.useGravity = true; val.velocity = Vector3.down * SlamSpeed; } } if ((Object)(object)floater.Collider != (Object)null && (Object)(object)floater.Aim != (Object)null) { Jak3Guns.JakDamage.Hit(floater.Collider, JakDamage, floater.Aim.position, Vector3.down, Vector3.up, m_iff, floater.Aim.position + Vector3.up, 0f); } } } private void OnDestroy() { if (m_slammed) { return; } foreach (Floater floater in m_floaters) { Rigidbody[] bodies = floater.Bodies; foreach (Rigidbody val in bodies) { if ((Object)(object)val != (Object)null) { val.useGravity = true; } } } } } public class JakGrenade : JakProjectile { [Header("Flight")] public float Speed = 40f; public float Gravity = 12f; public float Lifetime = 3f; public float Radius = 0.15f; [Tooltip("Speed kept off a bounce.")] public float Bounciness = 0.45f; public LayerMask HitMask; [Header("Burst")] public float ProximityRange = 2f; public float BlastRadius = 20f; public float JakDamage = 12f; public float PushSpeed = 7f; public GameObject ExplosionPrefab; public AudioClip[] BounceClips = (AudioClip[])(object)new AudioClip[0]; public float BounceVolume = 0.4f; [Tooltip("Keep fading after the grenade is gone (its trail).")] public ParticleSystem[] DetachOnBurst = (ParticleSystem[])(object)new ParticleSystem[0]; public TrailRenderer Trail; private Vector3 m_velocity; private Rigidbody m_own; private int m_iff; private float m_age; private bool m_done; public override void Launch(JakGun gun, Transform muzzle) { //IL_001f: 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_002f: Unknown result type (might be due to invalid IL or missing references) m_own = ((FVRPhysicalObject)gun).RootRigidbody; m_iff = GM.CurrentPlayerBody.GetPlayerIFF(); m_velocity = muzzle.forward * Speed; } private void Update() { //IL_0053: 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_003e: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00f4: 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_00fd: 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_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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: 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) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) if (m_done) { return; } float deltaTime = Time.deltaTime; m_age += deltaTime; if (m_age >= Lifetime) { Burst(((Component)this).transform.position); return; } if (JakTargets.InSphere(((Component)this).transform.position, ProximityRange, LayerMask.op_Implicit(HitMask), m_own).Count > 0) { Burst(((Component)this).transform.position); return; } m_velocity += Vector3.down * Gravity * deltaTime; Vector3 val = m_velocity * deltaTime; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 1E-05f) { return; } RaycastHit[] array = Physics.SphereCastAll(((Component)this).transform.position, Radius, val / magnitude, magnitude, LayerMask.op_Implicit(HitMask), (QueryTriggerInteraction)1); RaycastHit val2 = default(RaycastHit); bool flag = false; FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody; for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if ((!((Object)(object)m_own != (Object)null) || !((Object)(object)collider.attachedRigidbody == (Object)(object)m_own)) && (!((Object)(object)currentPlayerBody != (Object)null) || !((Component)collider).transform.IsChildOf(((Component)currentPlayerBody).transform)) && (!flag || ((RaycastHit)(ref array[i])).distance < ((RaycastHit)(ref val2)).distance)) { val2 = array[i]; flag = true; } } if (flag) { Vector3 val3 = ((!(((RaycastHit)(ref val2)).point == Vector3.zero)) ? ((RaycastHit)(ref val2)).point : (((Component)this).transform.position + val / magnitude * ((RaycastHit)(ref val2)).distance)); if (JakDamage > 0f && Jak3Guns.JakDamage.FindDamageable(((RaycastHit)(ref val2)).collider) != null) { Burst(val3); return; } ((Component)this).transform.position = val3 + ((RaycastHit)(ref val2)).normal * (Radius + 0.01f); m_velocity = Vector3.Reflect(m_velocity, ((RaycastHit)(ref val2)).normal) * Bounciness; if (BounceClips.Length > 0 && ((Vector3)(ref m_velocity)).magnitude > 2f) { AudioClip val4 = BounceClips[Random.Range(0, BounceClips.Length)]; if ((Object)(object)val4 != (Object)null) { AudioSource.PlayClipAtPoint(val4, val3, BounceVolume); } } } else { Transform transform = ((Component)this).transform; transform.position += val; } } private void Burst(Vector3 point) { //IL_0030: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00bd: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f7: 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) m_done = true; if ((Object)(object)ExplosionPrefab != (Object)null) { Object.Instantiate<GameObject>(ExplosionPrefab, point, Quaternion.identity); } GM.CurrentSceneSettings.PingReceivers(point); List<JakTarget> list = JakTargets.InSphere(point, BlastRadius, LayerMask.op_Implicit(HitMask), m_own); for (int i = 0; i < list.Count; i++) { if (!((Object)(object)list[i].Aim == (Object)null)) { Vector3 position = list[i].Aim.position; Vector3 val = position - point; val = ((!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) ? Vector3.up : ((Vector3)(ref val)).normalized); Collider collider = list[i].Collider; float jakDamage = JakDamage; Vector3 val2 = val + Vector3.up * 0.5f; Jak3Guns.JakDamage.Hit(collider, jakDamage, position, ((Vector3)(ref val2)).normalized, -val, m_iff, point, PushSpeed); } } for (int j = 0; j < DetachOnBurst.Length; j++) { ParticleSystem val3 = DetachOnBurst[j]; if (!((Object)(object)val3 == (Object)null)) { ((Component)val3).transform.SetParent((Transform)null, true); val3.Stop(true, (ParticleSystemStopBehavior)1); Object.Destroy((Object)(object)((Component)val3).gameObject, 1.5f); } } if ((Object)(object)Trail != (Object)null) { ((Component)Trail).transform.SetParent((Transform)null, true); Trail.autodestruct = true; } Object.Destroy((Object)(object)((Component)this).gameObject); } } public enum JakGunColor { Red, Yellow, Blue, Dark } public enum JakTriggerMode { Tap, Spin, Charge } public class JakGun : FVRFireArm { [Header("Jak 3 gun")] public JakGunColor GunColor = JakGunColor.Yellow; public JakGunRig Rig; [Tooltip("The rig pose for this form (Jak's gun-idle-<mode>).")] public string Mode = "yellow"; [Tooltip("Clip played as each shot leaves: cut from Jak's fire animation. Empty for none.")] public string FireClip = "yellow-fire-slide"; public JakTriggerMode Trigger = JakTriggerMode.Tap; [Tooltip("Seconds between shots (Jak fire-delay / 300).")] public float FireDelay = 0.32f; [Tooltip("A pull this long before the gun is ready queues the next shot (Jak: 30/300 s).")] public float QueueWindow = 0.1f; public float JakTriggerPull = 0.75f; public float JakTriggerReset = 0.35f; [Tooltip("Rounds a shot takes from the canister (Jak's ammo-required, scaled to the canister).")] public int AmmoCost = 1; [Header("Upgrades")] [Tooltip("Where an upgrade mod seats (JakUpgradeInterface); it holds one at a time.")] public FVRFireArmAttachmentMount UpgradeMount; public JakLaser Laser; [Header("Spin (blue forms)")] [Tooltip("The drum spins up while the trigger is held.")] public bool SpinDrum; [Tooltip("Turns about SpinAxis (its own space) as the barrel spins.")] public Transform SpinBone; public Vector3 SpinAxis = Vector3.up; [Tooltip("Degrees per second at full spin (Jak: 218453 units/s, 1200 degrees).")] public float SpinSpeed = 1200f; public float SpinUpTime = 1.5f; public float SpinDownTime = 2f; [Tooltip("Fire delay from standing to full spin (Jak: 120 to 30 /300 s).")] public float SpinDelaySlow = 0.4f; public float SpinDelayFast = 0.1f; [Tooltip("Looping whine; louder and higher with the spin (Jak's blue-gun-whine).")] public AudioSource Whine; public float WhineVolume = 0.5f; [Header("Pump (red guns)")] [Tooltip("Worked by hand: each shot needs a pump back and forward, which chambers it from the canister.")] public JakPump Pump; [Header("Shot")] public JakProjectile ShotPrefab; [Tooltip("Metres per second, for bolts (Blaster: Jak's 819200 units/s = 200 m/s).")] public float ShotSpeed = 200f; public GameObject MuzzleFlashPrefab; [Tooltip("Spent casings, one per shot (Vulcan Fury).")] public ParticleSystem ShellEjector; [Header("Audio")] public AudioEvent AudEvent_Shot; public AudioEvent AudEvent_DryFire; public AudioEvent AudEvent_Grab; private float m_sinceShot = 999f; private bool m_pending; private float m_trigger; private int m_triggerFrame = -10; private bool m_triggerWasReset = true; private bool m_dryFired; private float m_spin; private float m_spinAngle; private Quaternion m_spinRest = Quaternion.identity; private JakProjectile m_charging; private bool m_chambered; private JakGunForm m_baseForm; private bool HasShot => ((Object)(object)Pump != (Object)null) ? m_chambered : ((Object)(object)base.Magazine != (Object)null && base.Magazine.m_numRounds >= AmmoCost); public bool Chambered => m_chambered; public bool TriggerHeld => !m_triggerWasReset && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null; public override void Awake() { //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) ((FVRFireArm)this).Awake(); m_baseForm = CaptureForm(); if ((Object)(object)Rig != (Object)null) { Rig.ApplyPose(Mode); } if ((Object)(object)SpinBone != (Object)null) { m_spinRest = SpinBone.localRotation; } if ((Object)(object)UpgradeMount != (Object)null) { UpgradeMount.m_maxAttachments = 1; } } private JakGunForm CaptureForm() { JakGunForm jakGunForm = new JakGunForm(); jakGunForm.Name = "base"; jakGunForm.Mode = Mode; jakGunForm.FireClip = FireClip; jakGunForm.Trigger = Trigger; jakGunForm.FireDelay = FireDelay; jakGunForm.AmmoCost = AmmoCost; jakGunForm.SpinDrum = SpinDrum; jakGunForm.ShotPrefab = ShotPrefab; jakGunForm.MuzzleFlashPrefab = MuzzleFlashPrefab; jakGunForm.AudEvent_Shot = AudEvent_Shot; jakGunForm.Recoil = base.RecoilProfile; jakGunForm.Laser = (Object)(object)Laser != (Object)null && ((Behaviour)Laser).enabled; jakGunForm.FireRange = ((!((Object)(object)Laser != (Object)null)) ? 0f : Laser.FireRange); return jakGunForm; } public void ApplyForm(JakGunForm form) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if (form != null) { Mode = form.Mode; FireClip = form.FireClip; Trigger = form.Trigger; FireDelay = form.FireDelay; AmmoCost = Mathf.Max(1, form.AmmoCost); SpinDrum = form.SpinDrum; ShotPrefab = form.ShotPrefab; MuzzleFlashPrefab = form.MuzzleFlashPrefab; AudEvent_Shot = form.AudEvent_Shot; if ((Object)(object)form.Recoil != (Object)null) { base.RecoilProfile = form.Recoil; } if ((Object)(object)Laser != (Object)null) { Laser.FireRange = form.FireRange; ((Behaviour)Laser).enabled = form.Laser; } if ((Object)(object)Rig != (Object)null) { Rig.ApplyPose(Mode); } if ((Object)(object)SpinBone != (Object)null) { m_spinRest = SpinBone.localRotation; } m_pending = false; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)15, 1f); } } public void RestoreBaseForm() { ApplyForm(m_baseForm); } public bool TakeAmmo(int rounds) { if ((Object)(object)base.Magazine == (Object)null || base.Magazine.m_numRounds < rounds) { return false; } for (int i = 0; i < rounds; i++) { base.Magazine.RemoveRound(0); } JakMagazine jakMagazine = base.Magazine as JakMagazine; if ((Object)(object)jakMagazine != (Object)null) { jakMagazine.Flash(); } return true; } public override void BeginInteraction(FVRViveHand hand) { bool isHeld = ((FVRInteractiveObject)this).IsHeld; ((FVRFireArm)this).BeginInteraction(hand); if (!isHeld) { PlaySound(AudEvent_Grab, (FVRPooledAudioType)4); } } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); m_trigger = hand.Input.TriggerFloat; m_triggerFrame = Time.frameCount; if ((Object)(object)base.Magazine != (Object)null && MagReleasePressed(hand)) { ((FVRFireArm)this).EjectMag(false); } } private static bool MagReleasePressed(FVRViveHand hand) { //IL_0023: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (hand.IsInStreamlinedMode) { return hand.Input.AXButtonDown; } Vector2 touchpadAxes = hand.Input.TouchpadAxes; return hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.2f && Vector2.Angle(touchpadAxes, Vector2.down) <= 45f; } public void PumpBack() { m_chambered = false; ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)10, 1f); } public void PumpForward() { if (!m_chambered && TakeAmmo(AmmoCost)) { m_chambered = true; } ((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)11, 1f); } public override void FVRUpdate() { ((FVRFireArm)this).FVRUpdate(); if (Time.frameCount - m_triggerFrame > 1) { m_trigger = 0f; } float deltaTime = Time.deltaTime; m_sinceShot += deltaTime; if ((Object)(object)Pump != (Object)null) { Pump.UpdatePump(deltaTime); } bool flag = false; if (m_trigger <= JakTriggerReset) { m_triggerWasReset = true; m_dryFired = false; } if (m_trigger >= JakTriggerPull && m_triggerWasReset) { m_triggerWasReset = false; flag = true; } bool triggerHeld = TriggerHeld; float num = FireDelay; if (SpinDrum || m_spin > 0f) { m_spin = Mathf.MoveTowards(m_spin, (!SpinDrum || !triggerHeld) ? 0f : 1f, deltaTime / ((!SpinDrum || !triggerHeld) ? SpinDownTime : SpinUpTime)); UpdateSpin(deltaTime); } if (Trigger == JakTriggerMode.Spin) { num = Mathf.Lerp(SpinDelaySlow, SpinDelayFast, m_spin); } if (flag && !HasShot) { if (!m_dryFired) { PlaySound(AudEvent_DryFire, (FVRPooledAudioType)3); } m_dryFired = true; } bool flag2 = m_sinceShot > num - QueueWindow; switch (Trigger) { case JakTriggerMode.Tap: if (flag && HasShot && flag2) { m_pending = true; } break; case JakTriggerMode.Spin: m_pending = triggerHeld && HasShot && flag2; break; case JakTriggerMode.Charge: m_pending = triggerHeld && HasShot && flag2 && (Object)(object)m_charging == (Object)null; break; } if (m_pending && m_sinceShot >= num && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { m_pending = false; Fire(); } else if (m_pending && (!((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null)) { m_pending = false; } } private void UpdateSpin(float dt) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) m_spinAngle = Mathf.Repeat(m_spinAngle + m_spin * SpinSpeed * dt, 360f); if ((Object)(object)SpinBone != (Object)null) { SpinBone.localRotation = m_spinRest * Quaternion.AngleAxis(m_spinAngle, SpinAxis); } if (!((Object)(object)Whine == (Object)null)) { float num = WhineVolume * Mathf.Min(1f, 2f * m_spin); Whine.volume = num; Whine.pitch = Mathf.Pow(2f, Mathf.Lerp(-0.9f, 0.5f, m_spin)); if (num > 0.001f && !Whine.isPlaying) { Whine.Play(); } else if (num <= 0.001f && Whine.isPlaying) { Whine.Stop(); } } } private void Fire() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (HasShot) { if ((Object)(object)Pump != (Object)null) { m_chambered = false; } else if (!TakeAmmo(AmmoCost)) { return; } m_sinceShot = 0f; Transform muzzle = ((FVRFireArm)this).GetMuzzle(); JakProjectile jakProjectile = null; if ((Object)(object)ShotPrefab != (Object)null) { GameObject val = Object.Instantiate<GameObject>(((Component)ShotPrefab).gameObject, muzzle.position, muzzle.rotation); jakProjectile = val.GetComponent<JakProjectile>(); jakProjectile.Launch(this, muzzle); } if (Trigger == JakTriggerMode.Charge && (Object)(object)jakProjectile != (Object)null) { m_charging = jakProjectile; } else { Discharge(); } } } public void Discharge() { //IL_0021: 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) Transform muzzle = ((FVRFireArm)this).GetMuzzle(); if ((Object)(object)MuzzleFlashPrefab != (Object)null) { GameObject val = Object.Instantiate<GameObject>(MuzzleFlashPrefab, muzzle.position, muzzle.rotation); val.transform.SetParent(muzzle, true); } if ((Object)(object)Rig != (Object)null && !string.IsNullOrEmpty(FireClip)) { Rig.Play(FireClip); } if ((Object)(object)ShellEjector != (Object)null) { ShellEjector.Emit(1); } ((FVRFireArm)this).Recoil(((FVRFireArm)this).IsTwoHandStabilized(), ((FVRFireArm)this).IsForegripStabilized(), ((FVRFireArm)this).IsShoulderStabilized(), (FVRFireArmRecoilProfile)null, 1f); if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null) { ((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_GunShot); } if ((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand != (Object)null) { ((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Buzz(((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Buzzer.Buzz_GunShot); } GM.CurrentSceneSettings.OnShotFired((FVRFireArm)(object)this); GM.CurrentPlayerBody.VisibleEvent(2f); PlaySound(AudEvent_Shot, (FVRPooledAudioType)1); } public void EndCharge(JakProjectile shot) { if ((Object)(object)m_charging == (Object)(object)shot) { m_charging = null; } } public void PlaySound(AudioEvent ev, FVRPooledAudioType type) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004b: Expected I4, but got Unknown //IL_00ad: 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_0062: 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_00a0: Unknown result type (might be due to invalid IL or missing references) if (ev == null || ev.Clips == null || ev.Clips.Count == 0) { return; } Vector3 position = ((FVRFireArm)this).GetMuzzle().position; switch (type - 1) { case 0: if (base.m_pool_shot != null) { base.m_pool_shot.PlayClip(ev, position, (AudioMixerGroup)null); } break; case 2: if (base.m_pool_mechanics != null) { base.m_pool_mechanics.PlayClip(ev, position, (AudioMixerGroup)null); } break; case 3: if (base.m_pool_handling != null) { base.m_pool_handling.PlayClip(ev, position, (AudioMixerGroup)null); } break; default: SM.PlayCoreSound(type, ev, position); break; } } } [Serializable] public class JakGunForm { public string Name; [Tooltip("The rig pose (Jak's gun-idle-<mode>).")] public string Mode; public string FireClip; public JakTriggerMode Trigger; public float FireDelay; [Tooltip("Rounds a shot takes from the canister (Jak's ammo-required, scaled to the canister).")] public int AmmoCost = 1; [Tooltip("The drum spins while the trigger is held (the blue forms).")] public bool SpinDrum; public JakProjectile ShotPrefab; public GameObject MuzzleFlashPrefab; public AudioEvent AudEvent_Shot; public FVRFireArmRecoilProfile Recoil; [Tooltip("Jak's laser sight is on in this form.")] public bool Laser; public float FireRange; } [Serializable] public class JakBonePose { public Vector3 Pos; public Quaternion Rot = Quaternion.identity; public Vector3 Scale = Vector3.one; } [Serializable] public class JakGunPose { public string Name; public JakBonePose[] Bones; } [Serializable] public class JakClipTrack { public int Bone; public Vector3[] Pos; public Quaternion[] Rot; public Vector3[] Scale; } [Serializable] public class JakGunClip { public string Name; public float[] Times; public JakClipTrack[] Tracks; } public class JakGunRig : MonoBehaviour { public Transform[] Bones; public JakGunPose[] Poses; public JakGunClip[] Clips; public string CurrentPose; [Tooltip("Playback speed of Jak's clips (1 = the game's own timing).")] public float ClipSpeed = 1f; private JakGunClip m_clip; private float m_clipTime; private JakGunPose m_pose; public bool IsPlaying => m_clip != null; private void Awake() { m_pose = Find(Poses, CurrentPose); } public void ApplyPose(string name) { JakGunPose jakGunPose = Find(Poses, name); if (jakGunPose == null) { Debug.LogWarning((object)("[Jak3Guns] " + name + ": no gun pose '" + name + "'")); } else { m_pose = jakGunPose; CurrentPose = name; m_clip = null; SetPose(jakGunPose); } } public void Play(string clipName) { JakGunClip jakGunClip = Find(Clips, clipName); if (jakGunClip != null && jakGunClip.Times != null && jakGunClip.Times.Length != 0) { if (m_pose != null) { SetPose(m_pose); } m_clip = jakGunClip; m_clipTime = 0f; Sample(jakGunClip, 0f); } } private void Update() { if (m_clip == null) { return; } m_clipTime += Time.deltaTime * ClipSpeed; float num = m_clip.Times[m_clip.Times.Length - 1]; if (m_clipTime >= num) { m_clip = null; if (m_pose != null) { SetPose(m_pose); } } else { Sample(m_clip, m_clipTime); } } private void SetPose(JakGunPose pose) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Min(Bones.Length, pose.Bones.Length); for (int i = 0; i < num; i++) { Transform val = Bones[i]; if (!((Object)(object)val == (Object)null)) { JakBonePose jakBonePose = pose.Bones[i]; val.localPosition = jakBonePose.Pos; val.localRotation = jakBonePose.Rot; val.localScale = jakBonePose.Scale; } } } private void Sample(JakGunClip clip, float t) { //IL_0115: 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_011a: 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_0125: 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_014d: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0295: Unknown result type (might be due to invalid IL or missing references) float[] times = clip.Times; int num = times.Length - 1; int i; for (i = 0; i + 1 < times.Length && times[i + 1] <= t; i++) { } int num2 = Mathf.Min(i + 1, num); float num3 = ((num2 <= i) ? 0f : Mathf.Clamp01((t - times[i]) / (times[num2] - times[i]))); for (int j = 0; j < clip.Tracks.Length; j++) { JakClipTrack jakClipTrack = clip.Tracks[j]; if (jakClipTrack.Bone >= 0 && jakClipTrack.Bone < Bones.Length && !((Object)(object)Bones[jakClipTrack.Bone] == (Object)null)) { Transform val = Bones[jakClipTrack.Bone]; JakBonePose jakBonePose = ((m_pose == null || jakClipTrack.Bone >= m_pose.Bones.Length) ? null : m_pose.Bones[jakClipTrack.Bone]); Vector3 val2 = jakBonePose?.Pos ?? val.localPosition; Quaternion val3 = jakBonePose?.Rot ?? val.localRotation; Vector3 val4 = jakBonePose?.Scale ?? val.localScale; Vector3 val5 = Vector3.Lerp(jakClipTrack.Pos[i], jakClipTrack.Pos[num2], num3); Quaternion val6 = Quaternion.Slerp(jakClipTrack.Rot[i], jakClipTrack.Rot[num2], num3); Vector3 val7 = Vector3.Lerp(jakClipTrack.Scale[i], jakClipTrack.Scale[num2], num3); Vector3 val8 = jakClipTrack.Scale[num]; val.localPosition = val2 + (val5 - jakClipTrack.Pos[num]); val.localRotation = val3 * (Quaternion.Inverse(jakClipTrack.Rot[num]) * val6); val.localScale = new Vector3(val4.x * Ratio(val7.x, val8.x), val4.y * Ratio(val7.y, val8.y), val4.z * Ratio(val7.z, val8.z)); } } } private static float Ratio(float value, float rest) { return (!(Mathf.Abs(rest) < 0.0001f)) ? (value / rest) : 1f; } private static JakGunPose Find(JakGunPose[] list, string name) { if (list == null || string.IsNullOrEmpty(name)) { return null; } for (int i = 0; i < list.Length; i++) { if (list[i] != null && list[i].Name == name) { return list[i]; } } return null; } private static JakGunClip Find(JakGunClip[] list, string name) { if (list == null || string.IsNullOrEmpty(name)) { return null; } for (int i = 0; i < list.Length; i++) { if (list[i] != null && list[i].Name == name) { return list[i]; } } return null; } } [RequireComponent(typeof(AudioSource))] public class JakImpactSound : MonoBehaviour { public AudioClip[] Clips; public Vector2 VolumeRange = new Vector2(0.5f, 0.5f); public Vector2 PitchRange = new Vector2(1f, 1f); private void Start() { if (Clips != null && Clips.Length != 0) { AudioSource component = ((Component)this).GetComponent<AudioSource>(); component.clip = Clips[Random.Range(0, Clips.Length)]; component.volume = Random.Range(VolumeRange.x, VolumeRange.y); component.pitch = Random.Range(PitchRange.x, PitchRange.y); component.Play(); } } } public class JakLaser : MonoBehaviour { public JakGun Gun; [Tooltip("Jak's laser joint: where the beam starts.")] public Transform Emitter; public float Range = 40f; [Tooltip("An enemy closer than this lights the lock-on dot (Jak's fire-range for the form).")] public float FireRange = 15f; public LayerMask HitMask; public LineRenderer Beam; [Tooltip("Holds two particles, placed by hand each frame: the dot [0] and the emitter glow [1].")] public ParticleSystem Sprites; public Color DotColor = new Color(1f, 0f, 0f, 0.5f); public Color LockColor = new Color(1f, 0.25f, 0.25f, 0.5f); public Color EmitterColor = new Color(1f, 0.12f, 0.12f, 0.2f); [Tooltip("Dot size per metre away, and its smallest and largest (Jak's is 0.4 m, 1.2 m locked on).")] public float DotPerMetre = 0.012f; public float DotMin = 0.025f; public float DotMax = 0.22f; public float LockScale = 2.2f; public float EmitterSize = 0.06f; private readonly Particle[] m_sprites = (Particle[])(object)new Particle[2]; private void OnDisable() { if ((Object)(object)Beam != (Object)null) { ((Renderer)Beam).enabled = false; } if ((Object)(object)Sprites != (Object)null) { Sprites.Clear(); } } private void LateUpdate() { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_0206: 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_0209: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_029a: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)Gun != (Object)null && ((FVRInteractiveObject)Gun).IsHeld; if ((Object)(object)Beam != (Object)null) { ((Renderer)Beam).enabled = flag; } if ((Object)(object)Sprites == (Object)null) { return; } if (!flag) { Sprites.Clear(); return; } Transform muzzle = ((FVRFireArm)Gun).GetMuzzle(); Vector3 position = muzzle.position; Vector3 forward = muzzle.forward; RaycastHit[] array = Physics.RaycastAll(position, forward, Range, LayerMask.op_Implicit(HitMask), (QueryTriggerInteraction)1); float num = Range; Collider val = null; for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if (!((Component)collider).transform.IsChildOf(((Component)Gun).transform) && (!((Object)(object)((FVRPhysicalObject)Gun).RootRigidbody != (Object)null) || !((Object)(object)collider.attachedRigidbody == (Object)(object)((FVRPhysicalObject)Gun).RootRigidbody)) && ((RaycastHit)(ref array[i])).distance < num) { num = ((RaycastHit)(ref array[i])).distance; val = collider; } } Vector3 val2 = position + forward * num; Vector3 val3 = ((!((Object)(object)Emitter != (Object)null)) ? position : Emitter.position); if ((Object)(object)Beam != (Object)null) { Beam.SetPosition(0, val3); Beam.SetPosition(1, val2); } bool flag2 = (Object)(object)val != (Object)null && num <= FireRange && IsEnemy(val); Vector3 val4 = ((!((Object)(object)GM.CurrentPlayerBody != (Object)null)) ? (val2 - forward) : GM.CurrentPlayerBody.Head.position); float size = Mathf.Clamp(Vector3.Distance(val4, val2) * DotPerMetre, DotMin, DotMax) * ((!flag2) ? 1f : LockScale); Vector3 val5 = val4 - val2; Place(0, val2 + ((Vector3)(ref val5)).normalized * 0.02f, size, (!flag2) ? DotColor : LockColor); Place(1, val3, EmitterSize, EmitterColor); Sprites.SetParticles(m_sprites, 2); } private void Place(int i, Vector3 pos, float size, Color color) { //IL_000d: 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_0033: Unknown result type (might be due to invalid IL or missing references) ((Particle)(ref m_sprites[i])).position = pos; ((Particle)(ref m_sprites[i])).startSize = size; ((Particle)(ref m_sprites[i])).startColor = Color32.op_Implicit(color); ((Particle)(ref m_sprites[i])).startLifetime = 1f; ((Particle)(ref m_sprites[i])).remainingLifetime = 1f; } private static bool IsEnemy(Collider c) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 Rigidbody attachedRigidbody = c.attachedRigidbody; if ((Object)(object)attachedRigidbody == (Object)null) { return false; } SosigLink component = ((Component)attachedRigidbody).GetComponent<SosigLink>(); if ((Object)(object)component == (Object)null || (Object)(object)component.S == (Object)null || (int)component.S.BodyState == 3) { return false; } return (Object)(object)GM.CurrentPlayerBody == (Object)null || component.S.GetIFF() != GM.CurrentPlayerBody.GetPlayerIFF(); } } [RequireComponent(typeof(LineRenderer))] public class JakLightning : MonoBehaviour { public int Points = 12; [Tooltip("Largest sideways kink, as a fraction of the arc's length (capped at MaxJitter metres).")] public float Jitter = 0.12f; public float MaxJitter = 0.6f; public float Rejitter = 0.05f; public float Lifetime = 0.5f; public Color StartColor = new Color(1f, 1f, 1f, 0.5f); public Color FadeColor = new Color(0.75f, 0f, 0.56f, 0.02f); public AudioSource Zap; [Tooltip("Alternatives for Zap, one picked at random per arc.")] public AudioClip[] ZapClips = (AudioClip[])(object)new AudioClip[0]; private LineRenderer m_line; private Transform m_from; private Transform m_to; private Vector3 m_fromPos; private Vector3 m_toPos; private float m_age; private float m_nextJitter; private Vector3[] m_offsets; public void Strike(Transform from, Vector3 fromPos, Transform to, Vector3 toPos) { //IL_0027: 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_0028: 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_003b: 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_00bf: Unknown result type (might be due to invalid IL or missing references) m_from = from; m_to = to; m_fromPos = ((!((Object)(object)from != (Object)null)) ? fromPos : from.position); m_toPos = ((!((Object)(object)to != (Object)null)) ? toPos : to.position); if ((Object)(object)Zap != (Object)null && ZapClips.Length > 0) { Zap.clip = ZapClips[Random.Range(0, ZapClips.Length)]; } if ((Object)(object)Zap != (Object)null && (Object)(object)Zap.clip != (Object)null) { ((Component)Zap).transform.position = m_toPos; Zap.Play(); } Redraw(jitter: true); } private void Awake() { m_line = ((Component)this).GetComponent<LineRenderer>(); m_line.useWorldSpace = true; m_line.positionCount = Points; m_offsets = (Vector3[])(object)new Vector3[Points]; } private void Update() { m_age += Time.deltaTime; if (m_age >= Lifetime) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Redraw(m_age >= m_nextJitter); } } private void Redraw(bool jitter) { //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_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_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_01b6: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d9: 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_00e3: 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_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_from != (Object)null) { m_fromPos = m_from.position; } if ((Object)(object)m_to != (Object)null) { m_toPos = m_to.position; } Vector3 val = m_toPos - m_fromPos; float magnitude = ((Vector3)(ref val)).magnitude; if (jitter) { m_nextJitter = m_age + Rejitter; float num = Mathf.Min(magnitude * Jitter, MaxJitter); for (int i = 0; i < Points; i++) { float num2 = ((Points <= 1) ? 0f : ((float)i / (float)(Points - 1))); ref Vector3 reference = ref m_offsets[i]; reference = ((i != 0 && i != Points - 1) ? (Random.insideUnitSphere * num * Mathf.Sin(num2 * (float)Math.PI)) : Vector3.zero); } } for (int j = 0; j < Points; j++) { float num3 = ((Points <= 1) ? 0f : ((float)j / (float)(Points - 1))); m_line.SetPosition(j, m_fromPos + val * num3 + m_offsets[j]); } Color val2 = Color.Lerp(StartColor, FadeColor, m_age / Lifetime); LineRenderer line = m_line; Color val3 = val2; m_line.endColor = val3; line.startColor = val3; } } public class JakLoopSound : MonoBehaviour { public AudioSource Intro; public AudioSource Loop; public float FadeOut = 0.08f; private float m_volume = 1f; private float m_fade = -1f; private void Awake() { if ((Object)(object)Loop != (Object)null) { m_volume = Loop.volume; } } public void Play() { m_fade = -1f; double num = AudioSettings.dspTime + 0.02; if ((Object)(object)Intro != (Object)null && (Object)(object)Intro.clip != (Object)null) { Intro.volume = m_volume; Intro.PlayScheduled(num); num += (double)Intro.clip.samples / (double)Intro.clip.frequency; } if ((Object)(object)Loop != (Object)null && (Object)(object)Loop.clip != (Object)null) { Loop.volume = m_volume; Loop.loop = true; Loop.PlayScheduled(num); } } public void Stop() { if (m_fade < 0f) { m_fade = 0f; } } private void Update() { if (m_fade < 0f) { return; } m_fade += Time.deltaTime; float num = ((!(FadeOut > 0f)) ? 0f : Mathf.Clamp01(1f - m_fade / FadeOut)); if ((Object)(object)Intro != (Object)null) { Intro.volume = m_volume * num; } if ((Object)(object)Loop != (Object)null) { Loop.volume = m_volume * num; } if (!(num > 0f)) { if ((Object)(object)Intro != (Object)null) { Intro.Stop(); } if ((Object)(object)Loop != (Object)null) { Loop.Stop(); } m_fade = -1f; } } } public class JakMagGrab : FVRInteractiveObject { public JakGun Gun; public override bool IsInteractable() { return (Object)(object)Gun != (Object)null && (Object)(object)((FVRFireArm)Gun).Magazine != (Object)null; } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); if (!((Object)(object)Gun == (Object)null) && !((Object)(object)((FVRFireArm)Gun).Magazine == (Object)null)) { ((FVRInteractiveObject)this).EndInteraction(hand); FVRFireArmMagazine magazine = ((FVRFireArm)Gun).Magazine; ((FVRFireArm)Gun).EjectMag(false); hand.ForceSetInteractable((FVRInteractiveObject)(object)magazine); ((FVRInteractiveObject)magazine).BeginInteraction(hand); } } } public class JakMagazine : FVRFireArmMagazine { [Header("Jak 3 magazine")] public JakGunColor AmmoColor = JakGunColor.Yellow; public Renderer[] GlowRenderers = (Renderer[])(object)new Renderer[0]; public Light GlowLight; [Tooltip("Emission level when full; the emission map carries Jak's colour.")] public float GlowFull = 1f; public float GlowEmpty = 0.03f; public float LightFull = 0.6f; public float ShotFlash = 1.2f; private float m_flash; private MaterialPropertyBlock m_block; public override void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ((FVRFireArmMagazine)this).Awake(); m_block = new MaterialPropertyBlock(); UpdateGlow(); } public override void FVRUpdate() { ((FVRFireArmMagazine)this).FVRUpdate(); m_flash = Mathf.MoveTowards(m_flash, 0f, Time.deltaTime * 6f); UpdateGlow(); } public void Flash() { m_flash = 1f; } private void UpdateGlow() { //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_00cf: Unknown result type (might be due to invalid IL or missing references) if (m_block == null) { return; } float num = ((base.m_capacity <= 0) ? 0f : ((float)base.m_numRounds / (float)base.m_capacity)); float num2 = Mathf.Lerp(GlowEmpty, GlowFull, num) + m_flash * ShotFlash; if (base.m_numRounds == 0) { num2 *= 0.5f + 0.5f * Mathf.PerlinNoise(Time.time * 6f, 0.5f); } Color val = Color.white * num2; for (int i = 0; i < GlowRenderers.Length; i++) { Renderer val2 = GlowRenderers[i]; if (!((Object)(object)val2 == (Object)null)) { val2.GetPropertyBlock(m_block); m_block.SetColor("_EmissionColor", val); val2.SetPropertyBlock(m_block); } } if ((Object)(object)GlowLight != (Object)null) { GlowLight.intensity = LightFull * num2 / Mathf.Max(GlowFull, 0.01f); ((Behaviour)GlowLight).enabled = GlowLight.intensity > 0.02f; } } } public class JakNeedle : JakProjectile { [Header("Volley (on the prefab the gun fires)")] public int Count = 3; public float Spread = 8f; public float SeekRange = 40f; [Tooltip("Half-angle of the cone ahead of the barrel where targets are picked.")] public float SeekCone = 40f; [Header("Flight")] public float StartSpeed = 30f; public float TopSpeed = 100f; public float Acceleration = 140f; public float TurnRate = 360f; [Tooltip("Turn rate doubles as the needle closes within this.")] public float CloseRange = 12f; public float Lifetime = 3f; public float CastRadius = 0.08f; public LayerMask HitMask; [Tooltip("What hides a target from the needles (walls, the ground).")] public LayerMask WallMask; [Header("Damage")] public float JakDamage = 1f; public float PushSpeed = 0.6f; [Tooltip("Share of the damage that reaches the body through a sosig's armor (JakDamage.Hit).")] public float ArmorPierce = 0.75f; public GameObject ImpactPrefab; public TrailRenderer Trail; private Vector3 m_velocity; private Transform m_target; private object m_targetKey; private Rigidbody m_own; private int m_iff; private float m_age; private bool m_flying; private float m_nextLook; public override void Launch(JakGun gun, Transform muzzle) { //IL_0015: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_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_0088: 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_00cb: Unknown result type (might be due to invalid IL or missing references) Rigidbody rootRigidbody = ((FVRPhysicalObject)gun).RootRigidbody; int playerIFF = GM.CurrentPlayerBody.GetPlayerIFF(); List<JakTarget> list = Ahead(muzzle.position, muzzle.forward, rootRigidbody); for (int i = 0; i < Count; i++) { JakNeedle jakNeedle = ((i != 0) ? Object.Instantiate<JakNeedle>(this, muzzle.position, muzzle.rotation) : this); float num = (float)i * 360f / (float)Count; Vector3 dir = muzzle.rotation * Quaternion.AngleAxis(num, Vector3.forward) * Quaternion.AngleAxis(Spread, Vector3.right) * Vector3.forward; JakTarget? target = ((list.Count <= 0) ? ((JakTarget?)null) : new JakTarget?(list[i % list.Count])); jakNeedle.Fly(dir, target, rootRigidbody, playerIFF); } } private List<JakTarget> Ahead(Vector3 from, Vector3 forward, Rigidbody own) { //IL_0008: 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_0052: 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_0060: Unknown result type (might