Decompiled source of Shock Trooper v1.1.7
plugins/GaleShockTrooper/GaleShockTrooper.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AutoSprint.Core; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.GaleShockTrooperDroneStates; using EntityStates.GaleShockTrooperStates.Dash; using EntityStates.GaleShockTrooperStates.Weapon; using EntityStates.GaleShockTrooperStates.Weapon.MissilePainter; using ExtraDamageTypes; using GaleShockTrooper; using GaleShockTrooper.Characters.Drones.GaleShockTrooperDrone; using GaleShockTrooper.Characters.Drones.GaleShockTrooperDrone.Components; using GaleShockTrooper.Characters.Survivors.GaleShockTrooper.Achievements; using GaleShockTrooper.Characters.Survivors.GaleShockTrooper.Bossfight; using GaleShockTrooper.Characters.Survivors.GaleShockTrooper.Components; using GaleShockTrooper.Characters.Survivors.GaleShockTrooper.Content; using GaleShockTrooper.Modules; using GaleShockTrooper.Modules.Achievements; using GaleShockTrooper.Modules.Characters; using GaleShockTrooper.Survivors.GaleShockTrooperSurvivor; using GaleShockTrooper.Survivors.GaleShockTrooperSurvivor.Content; using HG; using HG.BlendableTypes; using IL.RoR2; using JetBrains.Annotations; using KinematicCharacterController; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using ShaderSwapper; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GaleShockTrooper")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GaleShockTrooper")] [assembly: AssemblyTitle("GaleShockTrooper")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace EntityStates.GaleShockTrooperStates.Weapon { public class AimSticky : AimThrowableBase { public static GameObject aimEndpointVisualizerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Huntress/HuntressArrowRainIndicator.prefab").WaitForCompletion(); public static GameObject aimArcVisualizerPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/BasicThrowableVisualizer.prefab").WaitForCompletion(); public static float smokeEffectFrequency = 10f; private float smokeEffectStopwatch = 0f; private float duration; public override void OnEnter() { base.maxDistance = 60f; base.rayRadius = 2f; base.arcVisualizerPrefab = aimArcVisualizerPrefab; base.projectilePrefab = ThrowSticky.projectilePrefab; base.endpointVisualizerPrefab = aimEndpointVisualizerPrefab; base.endpointVisualizerRadiusScale = ThrowSticky.blastRadius; base.setFuse = false; base.baseMinimumDuration = 0f; base.projectileBaseSpeed = ThrowSticky.projectileSpeed; base.damageCoefficient = ThrowSticky.damageCoefficient; ((AimThrowableBase)this).OnEnter(); duration = ThrowSticky.baseDuration / ((BaseState)this).attackSpeedStat; ((EntityState)this).PlayAnimation("Gesture, Override", "Missile_Start", "Shootgun.playbackRate", duration * 0.5f, 0f); ((BaseState)this).StartAimMode(2f, false); } public override void FixedUpdate() { ((AimThrowableBase)this).FixedUpdate(); ((BaseState)this).StartAimMode(2f, false); smokeEffectStopwatch += ((EntityState)this).GetDeltaTime(); if (smokeEffectStopwatch >= 1f / smokeEffectFrequency) { smokeEffectStopwatch -= 1f / smokeEffectFrequency; EffectManager.SimpleMuzzleFlash(PaintMissiles.smokeEffectPrefab, ((EntityState)this).gameObject, "VentL", false); EffectManager.SimpleMuzzleFlash(PaintMissiles.smokeEffectPrefab, ((EntityState)this).gameObject, "VentR", false); } } public override void FireProjectile() { } public override EntityState PickNextState() { return (EntityState)(object)new ThrowSticky(); } public override void OnExit() { ((EntityState)this).PlayAnimation("Gesture, Override", "Missile_Shoot", "Shootgun.playbackRate", duration, 0f); Util.PlaySound("Play_MULT_m1_grenade_launcher_shoot", ((EntityState)this).gameObject); ((BaseState)this).StartAimMode(2f, false); ((AimThrowableBase)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class DeployDrone : BaseState { public static float baseCooldown = 30f; public static float baseDuration = 1f; private float duration; private bool attemptedSpawn = false; public override void OnEnter() { ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(2f); duration = baseDuration / base.attackSpeedStat; Util.PlaySound("Play_drone_repair", ((EntityState)this).gameObject); ((EntityState)this).PlayAnimation("Gesture, Override", "DeployDrone", "Shootgun.playbackRate", duration, 0f); AttemptSpawnDroneSerer(); } private void AttemptSpawnDroneSerer() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || attemptedSpawn) { return; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master)) { attemptedSpawn = true; MasterDroneTracker masterDroneTracker = ((Component)((EntityState)this).characterBody.master).GetComponent<MasterDroneTracker>(); if (!Object.op_Implicit((Object)(object)masterDroneTracker)) { masterDroneTracker = ((Component)((EntityState)this).characterBody.master).gameObject.AddComponent<MasterDroneTracker>(); masterDroneTracker.master = ((EntityState)this).characterBody.master; } Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; direction.y = 0f; ((Vector3)(ref direction)).Normalize(); Vector3 pos = ((EntityState)this).characterBody.corePosition + Vector3.up * 2.5f + direction * 2.5f; masterDroneTracker.SummonDroneServer(pos, Util.QuaternionSafeLookRotation(direction)); } else { Debug.LogError((object)"CharacterBody has no master, failed to deploy drone!", (Object)(object)GaleShockTrooperPlugin.instance); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { if (!((EntityState)this).outer.destroying) { AttemptSpawnDroneSerer(); } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class FireRicochetSlug : BaseState { public static float ricochetRange = 45f; public static float damageCoefficient = 30f; public static float baseDuration = 0.6f; public static float force = 2000f; public static float recoil = 3f; public static int ricochetCount = 9; public static float selfKnockbackForce = 9000f; public static float baseCooldown = 20f; public static GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/OmniExplosionVFXFMJ.prefab").WaitForCompletion(); public static GameObject tracerEffectPrefab; public static GameObject muzzleflashEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/MuzzleflashBandit2.prefab").WaitForCompletion(); public static GameObject orbEffectPrefab; public static GameObject ricochetImpactEffect; private float duration; public override void OnEnter() { //IL_0091: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0139: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0156: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01bd: Expected O, but got Unknown //IL_01c3: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / base.attackSpeedStat; Util.PlaySound("Play_bandit_M2_shot", ((EntityState)this).gameObject); EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, "Muzzle", false); ((EntityState)this).PlayAnimation("Gesture, Override", "ShootSlug", "Shootgun.playbackRate", duration, 0f); if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && (!((EntityState)this).characterMotor.isGrounded || !(((EntityState)this).characterMotor.velocity == Vector3.zero))) { CharacterMotor characterMotor = ((EntityState)this).characterMotor; Ray aimRay = ((BaseState)this).GetAimRay(); characterMotor.ApplyForce(-((Ray)(ref aimRay)).direction * selfKnockbackForce, true, false); } Ray aimRay2 = ((BaseState)this).GetAimRay(); BulletAttack val = new BulletAttack { damage = base.damageStat * damageCoefficient, procChainMask = default(ProcChainMask), procCoefficient = 1f, maxDistance = 2000f, hitEffectPrefab = hitEffectPrefab, tracerEffectPrefab = tracerEffectPrefab, bulletCount = 1u, damageType = DamageTypeCombo.GenericSpecial, falloffModel = (FalloffModel)1, force = force, isCrit = ((BaseState)this).RollCrit(), muzzleName = "Muzzle", aimVector = ((Ray)(ref aimRay2)).direction, origin = ((Ray)(ref aimRay2)).origin, minSpread = 0f, maxSpread = 0f, owner = ((EntityState)this).gameObject, radius = 2f, smartCollision = true }; DamageAPI.AddModdedDamageType(ref val.damageType, CharacterDamageTypes.SpecialSlugProc); DamageAPI.AddModdedDamageType(ref val.damageType, CharacterDamageTypes.SpecialSlugVisual); val.Fire(); } ((BaseState)this).AddRecoil(0f - recoil, recoil, -0.5f * recoil, 0.5f * recoil); ((EntityState)this).characterBody.AddSpreadBloom(0.4f); ((EntityState)this).characterBody.SetAimTimer(2f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class FireShotgun : BaseState { public static float maxRange = 80f; public static uint pelletCount = 5u; public static float damageCoefficient = 0.4f; public static float procCoefficient = 0.6f; public static float baseDuration = 0.45f; public static float force = 100f; public static float spread = 3f; public static float recoil = 1f; public static GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/HitsparkCommandoShotgun.prefab").WaitForCompletion(); public static GameObject tracerEffectPrefab; public static GameObject muzzleflashEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/MuzzleflashFMJ.prefab").WaitForCompletion(); private float duration; public override void OnEnter() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c8: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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) ((BaseState)this).OnEnter(); duration = baseDuration / base.attackSpeedStat; Util.PlaySound("Play_captain_m1_shootWide", ((EntityState)this).gameObject); EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, "Muzzle", false); ((EntityState)this).PlayAnimation("Gesture, Override", "ShootGun", "Shootgun.playbackRate", duration, 0f); if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); new BulletAttack { damage = base.damageStat * damageCoefficient, procChainMask = default(ProcChainMask), procCoefficient = procCoefficient, maxDistance = maxRange, hitEffectPrefab = hitEffectPrefab, tracerEffectPrefab = tracerEffectPrefab, bulletCount = pelletCount, damageType = DamageTypeCombo.GenericPrimary, falloffModel = (FalloffModel)1, force = force, isCrit = ((BaseState)this).RollCrit(), muzzleName = "Muzzle", aimVector = ((Ray)(ref aimRay)).direction, origin = ((Ray)(ref aimRay)).origin, minSpread = 0f, maxSpread = spread, owner = ((EntityState)this).gameObject, radius = 0.3f, smartCollision = true }.Fire(); } ((BaseState)this).AddRecoil(0f - recoil, recoil, -0.5f * recoil, 0.5f * recoil); ((EntityState)this).characterBody.AddSpreadBloom(0.4f); ((EntityState)this).characterBody.SetAimTimer(2f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } public class ThrowSticky : BaseState { public static int baseMaxStocks = 1; public static float baseCooldown = 12f; public static float damageCoefficient = 6f; public static float blastRadius = 12f; public static float baseDuration = 0.6f; public static float detonationDelay = 1.5f; public static float projectileSpeed = 80f; public static GameObject projectilePrefab; public static GameObject muzzleflashEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/MuzzleflashSmokeRing.prefab").WaitForCompletion(); private float duration; public override void OnEnter() { //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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / base.attackSpeedStat; ((EntityState)this).characterBody.SetAimTimer(2f); Util.PlaySound("Play_MULT_m1_grenade_launcher_shoot", ((EntityState)this).gameObject); EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, "Muzzle", false); ((EntityState)this).PlayAnimation("Gesture, Override", "ShootSticky", "Shootgun.playbackRate", duration, 0f); if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); FireProjectileInfo val = default(FireProjectileInfo); val.crit = ((BaseState)this).RollCrit(); val.damage = base.damageStat * damageCoefficient; val.force = 400f; val.owner = ((EntityState)this).gameObject; val.position = ((Ray)(ref aimRay)).origin; val.projectilePrefab = projectilePrefab; val.procChainMask = default(ProcChainMask); val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction); val.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageType)131072) | DamageTypeCombo.op_Implicit((DamageSource)2); ((FireProjectileInfo)(ref val)).speedOverride = projectileSpeed; FireProjectileInfo val2 = val; ProjectileManager.instance.FireProjectile(val2); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)3; } } } namespace EntityStates.GaleShockTrooperStates.Weapon.MissilePainter { public class FireMissiles : BaseState { public static float baseDuration = 0.12f; public static GameObject projectilePrefab; public static float damageCoefficient = 4f; public static float force = 360f; public static GameObject muzzleflashEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/MuzzleflashFMJ.prefab").WaitForCompletion(); private float duration; private bool clearTargetList = true; public bool isCrit = false; public int maxAttacks; public int attacksFired; public List<PaintMissiles.TargetInfo> targetList; public override void OnEnter() { ((BaseState)this).OnEnter(); if (targetList == null) { targetList = new List<PaintMissiles.TargetInfo>(); } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.SetAimTimer(2f); } duration = baseDuration / base.attackSpeedStat; if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.secondary)) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.OnSkillActivated(((EntityState)this).skillLocator.secondary); if (NetworkServer.active) { HandleLuminousShotServer(((EntityState)this).characterBody); } } if (((EntityState)this).isAuthority) { ((EntityState)this).skillLocator.secondary.DeductStock(1); } } FireMissile(); } internal static void HandleLuminousShotServer(CharacterBody body) { if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCount(Items.IncreasePrimaryDamage) > 0) { body.AddIncreasePrimaryDamageStack(); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { if (attacksFired >= maxAttacks) { ((EntityState)this).outer.SetNextStateToMain(); return; } clearTargetList = false; ((EntityState)this).outer.SetNextState((EntityState)(object)new FireMissiles { targetList = targetList, attacksFired = attacksFired, maxAttacks = maxAttacks, isCrit = isCrit }); } } public override void OnExit() { if (clearTargetList) { foreach (PaintMissiles.TargetInfo target in targetList) { ((Indicator)target.indicator).active = false; ((Indicator)target.indicator).DestroyVisualizer(); } } ((EntityState)this).OnExit(); } private void FireMissile() { //IL_00ca: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) attacksFired++; Util.PlaySound("Play_GaleShockTrooper_MicroMissile", ((EntityState)this).gameObject); ((EntityState)this).PlayAnimation("Gesture, Override", "Missile_Shoot", "Shootgun.playbackRate", duration, 0f); EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, "Muzzle", false); EffectManager.SimpleMuzzleFlash(PaintMissiles.smokeEffectPrefab, ((EntityState)this).gameObject, "VentL", false); EffectManager.SimpleMuzzleFlash(PaintMissiles.smokeEffectPrefab, ((EntityState)this).gameObject, "VentR", false); if (!((EntityState)this).isAuthority) { return; } GameObject target = null; PaintMissiles.TargetInfo targetInfo = targetList.FirstOrDefault(); if (targetInfo != null) { targetInfo.SetTargetCount(targetInfo.GetTargetCount() - 1); target = ((Component)targetInfo.hurtBox).gameObject; } Ray aimRay = ((BaseState)this).GetAimRay(); int num = 0; if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.inventory)) { num = ((EntityState)this).characterBody.inventory.GetItemCount(Items.MoreMissile); } if (num > 0) { Vector3 val = Vector3.Cross(Vector3.up, ((Ray)(ref aimRay)).direction); Vector3 val2 = Vector3.Cross(((Ray)(ref aimRay)).direction, val); float num2 = 0f; float num3 = 0f; float num4 = 0f; num4 = Random.Range(1f + num2, 1f + num2) * 3f; num3 = num4 / 2f; Vector3 val3 = Quaternion.AngleAxis((0f - num4) * 0.5f, val2) * ((Ray)(ref aimRay)).direction; Quaternion val4 = Quaternion.AngleAxis(num3, val2); Ray val5 = default(Ray); ((Ray)(ref val5))..ctor(((Ray)(ref aimRay)).origin, val3); for (int i = 0; i < 3; i++) { FireProjectileInfo val6 = default(FireProjectileInfo); val6.damage = damageCoefficient * base.damageStat; val6.damageTypeOverride = DamageTypeCombo.GenericSecondary; val6.crit = isCrit; val6.force = force; val6.owner = ((EntityState)this).gameObject; val6.position = ((Ray)(ref aimRay)).origin; val6.procChainMask = default(ProcChainMask); val6.projectilePrefab = projectilePrefab; val6.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref val5)).direction); val6.target = target; FireProjectileInfo val7 = val6; val7.damage *= 1f + 0.5f * (float)(num - 1); ProjectileManager.instance.FireProjectile(val7); ((Ray)(ref val5)).direction = val4 * ((Ray)(ref val5)).direction; } } else { FireProjectileInfo val6 = default(FireProjectileInfo); val6.damage = damageCoefficient * base.damageStat; val6.damageTypeOverride = DamageTypeCombo.GenericSecondary; val6.crit = isCrit; val6.force = force; val6.owner = ((EntityState)this).gameObject; val6.position = ((Ray)(ref aimRay)).origin; val6.procChainMask = default(ProcChainMask); val6.projectilePrefab = projectilePrefab; val6.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction); val6.target = target; FireProjectileInfo val8 = val6; ProjectileManager.instance.FireProjectile(val8); } targetList = targetList.Where((PaintMissiles.TargetInfo tInfo) => tInfo.GetTargetCount() > 0).ToList(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class PaintMissiles : BaseState { public enum InputMode { Hold, Toggle, M2Only } public class TargetInfo { public HurtBox hurtBox; public STMissileIndicator indicator; private int targetCount; public TargetInfo(GameObject owner, HurtBox hurtBox) { this.hurtBox = hurtBox; indicator = new STMissileIndicator(owner, missileTrackingIndicator); ((Indicator)indicator).targetTransform = ((Component)hurtBox).transform; ((Indicator)indicator).active = true; SetTargetCount(1); } public int GetTargetCount() { return targetCount; } public void SetTargetCount(int i) { targetCount = i; indicator.missileCount = targetCount; } } public class STMissileIndicator : Indicator { public int missileCount; public override void UpdateVisualizer() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) ((Indicator)this).UpdateVisualizer(); Transform val = ((Indicator)this).visualizerTransform.Find("DotOrigin"); for (int num = val.childCount - 1; num >= missileCount; num--) { EntityState.Destroy((Object)(object)((Component)val.GetChild(num)).gameObject); } for (int i = val.childCount; i < missileCount; i++) { GameObject val2 = Object.Instantiate<GameObject>(((Component)((Indicator)this).visualizerPrefab.transform.Find("DotOrigin/DotTemplate")).gameObject, val); ((Indicator)this).FindRenderers(val2.transform); } if (val.childCount > 0) { float num2 = 360f / (float)val.childCount; float num3 = (float)(val.childCount - 1) * 90f; for (int j = 0; j < val.childCount; j++) { Transform child = val.GetChild(j); ((Component)child).gameObject.SetActive(true); child.localRotation = Quaternion.Euler(0f, 0f, num3 + (float)j * num2); } } } public STMissileIndicator(GameObject owner, GameObject visualizerPrefab) : base(owner, visualizerPrefab) { } } public static ConfigEntry<InputMode> selectedInput; public static GameObject missileTrackingIndicator = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiMissileTrackingIndicator.prefab").WaitForCompletion(); public static GameObject crosshairOverridePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerCrosshair.prefab").WaitForCompletion(); public static GameObject smokeEffectPrefab; public static SkillDef primaryOverride = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiConfirmTargetDummy.asset").WaitForCompletion(); public static string entrySoundString = "Play_railgunner_m2_scope_in"; public static string exitSoundString = "Play_railgunner_m2_scope_out"; public static float baseEntryduration = 0.3f; public static float baseLockonDuration = 0.45f; public static float baseLockonAngle = 60f; public static float baseLockonRange = 200f; public static int baseMaxStocks = 6; public static float baseCooldown = 6f; public static float smokeEffectFrequency = 10f; private float smokeEffectStopwatch = 0f; private Indicator generalIndicator; private float lockonDuration; private float lockonStopwatch; private OverrideRequest crosshairOverrideRequest; private GenericSkill overriddenSkill; public BullseyeSearch search; private HurtBox lockonTarget; public List<TargetInfo> targetList; private bool startedPainting = false; private bool clearTargetList = true; private bool buttonReleased = false; private bool buttonRepressed = false; private bool appliedOverride = false; public override void OnEnter() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown ((BaseState)this).OnEnter(); search = new BullseyeSearch(); generalIndicator = new Indicator(((EntityState)this).gameObject, missileTrackingIndicator); targetList = new List<TargetInfo>(); lockonStopwatch = 0f; lockonDuration = baseLockonDuration / base.attackSpeedStat; Util.PlaySound(entrySoundString, ((EntityState)this).gameObject); Util.PlaySound("Play_railgunner_m2_scope_loop", ((EntityState)this).gameObject); ((EntityState)this).PlayAnimation("Gesture, Override", "Missile_Start", "Shootgun.playbackRate", baseEntryduration / base.attackSpeedStat, 0f); crosshairOverrideRequest = CrosshairUtils.RequestOverrideForBody(((EntityState)this).characterBody, crosshairOverridePrefab, (OverridePriority)1); if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.SetAimTimer(2f); } if (selectedInput.Value != InputMode.M2Only) { GenericSkill val = (((Object)(object)((EntityState)this).skillLocator != (Object)null) ? ((EntityState)this).skillLocator.primary : null); if (Object.op_Implicit((Object)(object)val)) { appliedOverride = true; TryOverrideSkill(val); val.onSkillChanged += TryOverrideSkill; } } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); smokeEffectStopwatch += ((EntityState)this).GetDeltaTime(); if (smokeEffectStopwatch >= 1f / smokeEffectFrequency) { smokeEffectStopwatch -= 1f / smokeEffectFrequency; EffectManager.SimpleMuzzleFlash(smokeEffectPrefab, ((EntityState)this).gameObject, "VentL", false); EffectManager.SimpleMuzzleFlash(smokeEffectPrefab, ((EntityState)this).gameObject, "VentR", false); } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.SetAimTimer(2f); } if (!((EntityState)this).isAuthority) { return; } if (GetCurrentTargets() < GetMaxTargets()) { UpdateTrackerAuthority(); if (startedPainting) { UpdatePainterAuthority(); } } else { generalIndicator.targetTransform = null; generalIndicator.active = false; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && !((EntityState)this).characterBody.isPlayerControlled) { if (((EntityState)this).fixedAge >= lockonDuration * (float)GetMaxTargets()) { ((EntityState)this).outer.SetNextState((EntityState)(object)new FireMissiles { attacksFired = 0, targetList = targetList, maxAttacks = GetMaxTargets(), isCrit = ((BaseState)this).RollCrit() }); } return; } bool flag = false; if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank)) { if (!startedPainting && (((EntityState)this).inputBank.skill1.down || selectedInput.Value == InputMode.M2Only)) { startedPainting = true; } else if (startedPainting && ((selectedInput.Value != InputMode.M2Only && !((EntityState)this).inputBank.skill1.down) || (selectedInput.Value == InputMode.M2Only && !((EntityState)this).inputBank.skill2.down))) { if (GetCurrentTargets() > 0) { ((EntityState)this).outer.SetNextState((EntityState)(object)new FireMissiles { attacksFired = 0, targetList = targetList, maxAttacks = GetCurrentTargets(), isCrit = ((BaseState)this).RollCrit() }); return; } lockonStopwatch = 0f; startedPainting = false; } if (selectedInput.Value == InputMode.Toggle) { if (!buttonReleased && !((EntityState)this).inputBank.skill2.down) { buttonReleased = true; } else if (buttonReleased && ((EntityState)this).inputBank.skill2.down) { buttonRepressed = true; } else if (buttonRepressed && buttonRepressed && !((EntityState)this).inputBank.skill2.down) { flag = true; } } else if ((selectedInput.Value == InputMode.Hold || selectedInput.Value == InputMode.M2Only) && !((EntityState)this).inputBank.skill2.down && !startedPainting) { flag = true; } } else { flag = true; } if (flag) { ((EntityState)this).outer.SetNextStateToMain(); } } private int GetMaxTargets() { if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.secondary)) { return ((EntityState)this).skillLocator.secondary.stock; } return 3; } private int GetCurrentTargets() { int num = 0; foreach (TargetInfo target in targetList) { num += target.GetTargetCount(); } return num; } private void UpdateTrackerAuthority() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) HurtBox val = lockonTarget; SearchForTarget(((BaseState)this).GetAimRay()); if (Object.op_Implicit((Object)(object)lockonTarget)) { generalIndicator.targetTransform = ((Component)lockonTarget).transform; generalIndicator.active = true; foreach (TargetInfo target in targetList) { if ((Object)(object)target.hurtBox == (Object)(object)lockonTarget) { generalIndicator.active = false; break; } } } else { generalIndicator.targetTransform = null; generalIndicator.active = false; } if ((Object)(object)lockonTarget != (Object)(object)val) { lockonStopwatch = (Object.op_Implicit((Object)(object)lockonTarget) ? (lockonDuration * 0.75f) : 0f); } } private void UpdatePainterAuthority() { if (Object.op_Implicit((Object)(object)lockonTarget)) { lockonStopwatch += ((EntityState)this).GetDeltaTime(); if (lockonStopwatch >= lockonDuration || GetCurrentTargets() <= 0) { lockonStopwatch = 0f; AddLockonTarget(); } } } private void AddLockonTarget() { if (!Object.op_Implicit((Object)(object)lockonTarget)) { return; } Util.PlaySound("Play_engi_seekerMissile_lockOn", ((EntityState)this).gameObject); bool flag = false; foreach (TargetInfo target in targetList) { if ((Object)(object)target.hurtBox == (Object)(object)lockonTarget) { flag = true; target.SetTargetCount(target.GetTargetCount() + 1); break; } } if (!flag) { TargetInfo item = new TargetInfo(((EntityState)this).gameObject, lockonTarget); targetList.Add(item); } } public override void OnExit() { generalIndicator.active = false; generalIndicator.DestroyVisualizer(); if (clearTargetList) { foreach (TargetInfo target in targetList) { ((Indicator)target.indicator).active = false; ((Indicator)target.indicator).DestroyVisualizer(); } } if (appliedOverride) { GenericSkill val = (((Object)(object)((EntityState)this).skillLocator != (Object)null) ? ((EntityState)this).skillLocator.primary : null); if (Object.op_Implicit((Object)(object)val)) { val.onSkillChanged -= TryOverrideSkill; } if (Object.op_Implicit((Object)(object)overriddenSkill)) { overriddenSkill.UnsetSkillOverride((object)this, primaryOverride, (SkillOverridePriority)4); } } if (crosshairOverrideRequest != null) { crosshairOverrideRequest.Dispose(); } Util.PlaySound("Stop_railgunner_m2_scope_loop", ((EntityState)this).gameObject); Util.PlaySound(exitSoundString, ((EntityState)this).gameObject); if (!((EntityState)this).outer.destroying) { ((EntityState)this).PlayAnimation("Gesture, Override", "BufferEmpty", "Shootgun.playbackRate", baseEntryduration / base.attackSpeedStat, 0f); } ((EntityState)this).OnExit(); } private void SearchForTarget(Ray aimRay) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_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) search.teamMaskFilter = TeamMask.all; ((TeamMask)(ref search.teamMaskFilter)).RemoveTeam(((BaseState)this).GetTeam()); search.filterByLoS = true; search.searchOrigin = ((Ray)(ref aimRay)).origin; search.searchDirection = ((Ray)(ref aimRay)).direction; search.sortMode = (SortMode)2; search.maxDistanceFilter = baseLockonRange; search.maxAngleFilter = baseLockonAngle; search.RefreshCandidates(); search.FilterOutGameObject(((EntityState)this).gameObject); lockonTarget = search.GetResults().FirstOrDefault(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)3; } private void TryOverrideSkill(GenericSkill skill) { if (Object.op_Implicit((Object)(object)skill) && !Object.op_Implicit((Object)(object)overriddenSkill) && !skill.HasSkillOverrideOfPriority((SkillOverridePriority)4)) { overriddenSkill = skill; overriddenSkill.SetSkillOverride((object)this, primaryOverride, (SkillOverridePriority)4); overriddenSkill.stock = ((EntityState)this).skillLocator.secondary.stock; } } } } namespace EntityStates.GaleShockTrooperStates.Dash { public class EnterShockDash : BaseState { public static float baseCooldown = 8f; public static float baseDuration = 0f; private float duration; private HurtBoxGroup hurtboxGroup; public override void OnEnter() { ((BaseState)this).OnEnter(); duration = baseDuration / base.attackSpeedStat; if (baseDuration > 0f) { Util.PlaySound("Play_merc_shift_start", ((EntityState)this).gameObject); } if (Object.op_Implicit((Object)(object)hurtboxGroup)) { HurtBoxGroup val = hurtboxGroup; int hurtBoxesDeactivatorCounter = val.hurtBoxesDeactivatorCounter + 1; val.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity.y = 0f; } } public override void OnExit() { ((EntityState)this).OnExit(); if (Object.op_Implicit((Object)(object)hurtboxGroup)) { HurtBoxGroup val = hurtboxGroup; int hurtBoxesDeactivatorCounter = val.hurtBoxesDeactivatorCounter - 1; val.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity.y = 0f; } if (((EntityState)this).fixedAge >= duration) { ChangeStateAuthority(); } } } public void ChangeStateAuthority() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) if (!((EntityState)this).isAuthority) { return; } Vector3 val = ((EntityState)this).characterDirection.forward; Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; direction.y = 0f; ((Vector3)(ref direction)).Normalize(); string text = "DashF"; if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.moveVector != Vector3.zero) { val = ((Vector3)(ref ((EntityState)this).inputBank.moveVector)).normalized; float num = Vector3.SignedAngle(direction, val, Vector3.up); if (num >= 45f && num < 135f) { text = "DashR"; } else if (num <= -45f && num > -135f) { text = "DashL"; } else if (num >= 135f || num <= -135f) { text = "DashB"; } } switch (text) { case "DashB": ((EntityState)this).outer.SetNextState((EntityState)(object)new ShockDashB { blinkVector = val }); break; case "DashL": ((EntityState)this).outer.SetNextState((EntityState)(object)new ShockDashL { blinkVector = val }); break; case "DashR": ((EntityState)this).outer.SetNextState((EntityState)(object)new ShockDashR { blinkVector = val }); break; default: ((EntityState)this).outer.SetNextState((EntityState)(object)new ShockDashBase { blinkVector = ((Ray)(ref aimRay)).direction }); break; } } } public class ShockDashBase : BaseState { public static float shockRange = 12f; public static float shockDamageCoefficient = 1f; public static int shockTicksPerSecond = 30; public static float baseSpeed = 8f; public static float baseDuration = 0.3f; public static GameObject blinkPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Huntress/HuntressBlinkEffect.prefab").WaitForCompletion(); public static Material material1 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Huntress/matHuntressFlashBright.mat").WaitForCompletion(); public static Material material2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Huntress/matHuntressFlashExpanded.mat").WaitForCompletion(); public Vector3 blinkVector; private float shockTickStopwatch; private Transform modelTransform; private CharacterModel characterModel; private HurtBoxGroup hurtboxGroup; private List<HealthComponent> victimList; private int originalLayer; public override void OnEnter() { //IL_0022: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Util.PlaySound("Play_huntress_shift_mini_blink", ((EntityState)this).gameObject); PlayDashAnim(); ((BaseState)this).StartAimMode(((BaseState)this).GetAimRay(), baseDuration + 0.3f, false); CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject)); modelTransform = ((EntityState)this).GetModelTransform(); if (Object.op_Implicit((Object)(object)modelTransform)) { characterModel = ((Component)modelTransform).GetComponent<CharacterModel>(); hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>(); CharacterModel component = ((Component)modelTransform).GetComponent<CharacterModel>(); if (Object.op_Implicit((Object)(object)component)) { TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((Component)component).gameObject); val.duration = 0.6f + baseDuration; val.animateShaderAlpha = true; val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); val.destroyComponentOnEnd = true; val.originalMaterial = material1; val.AddToCharacterModel(component); val.Start(); TemporaryOverlayInstance val2 = TemporaryOverlayManager.AddOverlay(((Component)component).gameObject); val2.duration = 0.7f + baseDuration; val2.animateShaderAlpha = true; val2.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); val2.destroyComponentOnEnd = true; val2.originalMaterial = material2; val2.AddToCharacterModel(component); val2.Start(); } } if (Object.op_Implicit((Object)(object)hurtboxGroup)) { HurtBoxGroup val3 = hurtboxGroup; int hurtBoxesDeactivatorCounter = val3.hurtBoxesDeactivatorCounter + 1; val3.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } if (NetworkServer.active) { victimList = new List<HealthComponent>(); ShockEnemiesServer(); shockTickStopwatch = 0f; } originalLayer = ((EntityState)this).gameObject.layer; ((EntityState)this).gameObject.layer = LayerIndex.GetAppropriateFakeLayerForTeam(((BaseState)this).GetTeam()).intVal; ((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (NetworkServer.active) { shockTickStopwatch += Time.fixedDeltaTime; if (shockTickStopwatch >= 1f / (float)shockTicksPerSecond) { ShockEnemiesServer(); } } if (((EntityState)this).isAuthority) { DashPhysics(); if (((EntityState)this).fixedAge >= baseDuration) { ((EntityState)this).outer.SetNextStateToMain(); } } } public override void OnExit() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).gameObject.layer = originalLayer; ((BaseCharacterController)((EntityState)this).characterMotor).Motor.RebuildCollidableLayers(); if (!((EntityState)this).outer.destroying) { CreateBlinkEffect(Util.GetCorePosition(((EntityState)this).gameObject)); } if (Object.op_Implicit((Object)(object)hurtboxGroup)) { HurtBoxGroup val = hurtboxGroup; int hurtBoxesDeactivatorCounter = val.hurtBoxesDeactivatorCounter - 1; val.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)3; } public virtual void ShockEnemiesServer() { //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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00ce: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00f2: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_013e: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown if (!NetworkServer.active) { return; } if (shockTickStopwatch != 0f) { shockTickStopwatch -= 1f / (float)shockTicksPerSecond; } TeamIndex team = ((BaseState)this).GetTeam(); Vector3 corePosition = Util.GetCorePosition(((EntityState)this).gameObject); List<HealthComponent> list = Utils.FindEnemiesInSphere(shockRange, corePosition, team); foreach (HealthComponent item in list) { if (!victimList.Contains(item)) { victimList.Add(item); LightningOrb val = new LightningOrb { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, damageValue = base.damageStat * shockDamageCoefficient, procCoefficient = 1f, teamIndex = team, isCrit = ((BaseState)this).RollCrit(), procChainMask = default(ProcChainMask), lightningType = (LightningType)0, damageColorIndex = (DamageColorIndex)0, bouncesRemaining = 0, targetsToFindPerBounce = 1, range = shockRange, origin = corePosition, damageType = new DamageTypeCombo { damageType = (DamageType)16777216, damageSource = (DamageSource)4 }, speed = 120f, target = item.body.mainHurtBox }; OrbManager.instance.AddOrb((Orb)(object)val); } } } public virtual void PlayDashAnim() { ((EntityState)this).PlayAnimation("FullBody, Override", "DashF", "Dash.playbackRate", baseDuration, 0f); } public virtual void CreateBlinkEffect(Vector3 origin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown EffectData val = new EffectData { rotation = Util.QuaternionSafeLookRotation(blinkVector), origin = origin }; EffectManager.SpawnEffect(blinkPrefab, val, false); } public virtual void DashPhysics() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_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) if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && Object.op_Implicit((Object)(object)((EntityState)this).characterDirection)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.rootMotion += blinkVector * (base.moveSpeedStat * baseSpeed * Time.deltaTime); } } } public class ShockDashR : ShockDashBase { public override void PlayDashAnim() { ((EntityState)this).PlayAnimation("FullBody, Override", "DashR", "Dash.playbackRate", ShockDashBase.baseDuration, 0f); } } public class ShockDashL : ShockDashBase { public override void PlayDashAnim() { ((EntityState)this).PlayAnimation("FullBody, Override", "DashL", "Dash.playbackRate", ShockDashBase.baseDuration, 0f); } } public class ShockDashB : ShockDashBase { public override void PlayDashAnim() { ((EntityState)this).PlayAnimation("FullBody, Override", "DashB", "Dash.playbackRate", ShockDashBase.baseDuration, 0f); } } } namespace EntityStates.GaleShockTrooperDroneStates { public class FireAutoTurret : BaseState { public static float damageCoefficient = 1f; public static float lockonAngle = 60f; public static float baseShotDuration = 0.15f; public static float baseDuration = 0.5f; public static int shotsPerBurst = 2; public static GameObject muzzleflashEffectPrefab; public static GameObject orbEffectPrefab; public static float lockonRange = 90f; private float shotDuration; private float duration; private float stopwatch; private int shotsFired; private bool isCrit; private bool triggeredPrimary = false; private bool rightMuzzle; private Transform muzzleL; private Transform muzzleR; private HurtBox currentTarget; public override void OnEnter() { ((BaseState)this).OnEnter(); ((EntityState)this).characterBody.SetAimTimer(2f); rightMuzzle = true; isCrit = ((BaseState)this).RollCrit(); shotsFired = 0; shotDuration = baseShotDuration / base.attackSpeedStat; duration = baseDuration / base.attackSpeedStat; stopwatch = 0f; ChildLocator modelChildLocator = ((EntityState)this).GetModelChildLocator(); if (Object.op_Implicit((Object)(object)modelChildLocator)) { muzzleR = modelChildLocator.FindChild("MuzzleR"); muzzleL = modelChildLocator.FindChild("MuzzleL"); } DroneTargetingController component = ((EntityState)this).GetComponent<DroneTargetingController>(); currentTarget = component.GetCurrentTarget(); FireShot(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); stopwatch += ((EntityState)this).GetDeltaTime(); if (stopwatch >= shotDuration && shotsFired < shotsPerBurst) { stopwatch -= shotDuration; FireShot(); } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration && shotsFired >= shotsPerBurst) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { if (shotsFired < shotsPerBurst) { int num = shotsPerBurst - shotsFired; for (int i = 0; i < num; i++) { FireShot(playEffects: false); } } ((EntityState)this).OnExit(); } private void FireShot(bool playEffects = true) { shotsFired++; string text = (rightMuzzle ? "MuzzleR" : "MuzzleL"); Transform transform = ((EntityState)this).transform; if (rightMuzzle && Object.op_Implicit((Object)(object)muzzleR)) { transform = muzzleR; } else if (!rightMuzzle && Object.op_Implicit((Object)(object)muzzleL)) { transform = muzzleL; } rightMuzzle = !rightMuzzle; if (NetworkServer.active) { FireOrb(transform, playEffects); } } private void FireOrb(Transform muzzleTransform, bool playEffects) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: 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_0071: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_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) Ray aimRay = ((BaseState)this).GetAimRay(); if (Object.op_Implicit((Object)(object)currentTarget)) { ChainGunOrb val = new ChainGunOrb(orbEffectPrefab); ((GenericDamageOrb)val).damageValue = damageCoefficient * base.damageStat; ((GenericDamageOrb)val).isCrit = isCrit; ((GenericDamageOrb)val).teamIndex = ((BaseState)this).GetTeam(); ((GenericDamageOrb)val).attacker = ((EntityState)this).gameObject; ((GenericDamageOrb)val).procCoefficient = 1f; ((GenericDamageOrb)val).procChainMask = default(ProcChainMask); ((Orb)val).origin = muzzleTransform.position; ((GenericDamageOrb)val).speed = 200f; val.bouncesRemaining = 0; val.bounceRange = 60f; val.damageCoefficientPerBounce = 1f; val.targetsToFindPerBounce = 1; val.canBounceOnSameTarget = false; ((GenericDamageOrb)val).damageColorIndex = (DamageColorIndex)0; ((GenericDamageOrb)val).damageType = DamageTypeCombo.GenericSpecial; ((Orb)val).target = currentTarget; OrbManager.instance.AddOrb((Orb)(object)val); if (playEffects) { EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, ((Object)(object)muzzleTransform == (Object)(object)muzzleR) ? "MuzzleR" : "MuzzleL", true); } } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } } namespace GaleShockTrooper { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.TheConstellate.ShockTrooper", "Shock Trooper", "1.1.7")] public class GaleShockTrooperPlugin : BaseUnityPlugin { public const string MODUID = "com.TheConstellate.ShockTrooper"; public const string MODNAME = "Shock Trooper"; public const string MODVERSION = "1.1.7"; public const string DEVELOPER_PREFIX = "GALE"; public static GaleShockTrooperPlugin instance; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); Language.Init(); new GaleShockTrooperSurvivor().Initialize(); new GaleShockTrooperDroneCharacter().Initialize(); new ContentPacks().Initialize(); } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } internal class Utils { internal static List<HealthComponent> FindEnemiesInSphere(float radius, Vector3 position, TeamIndex team) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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) List<HealthComponent> list = new List<HealthComponent>(); Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)); for (int i = 0; i < array.Length; i++) { HurtBox component = ((Component)array[i]).GetComponent<HurtBox>(); if (Object.op_Implicit((Object)(object)component)) { HealthComponent healthComponent = component.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent) && !list.Contains(healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) && healthComponent.body.teamComponent.teamIndex != team) { list.Add(healthComponent); } } } return list; } } } namespace GaleShockTrooper.Modules { internal static class Asset { internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (bundleName == "myassetbundle") { Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code "); return null; } if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; try { val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)GaleShockTrooperPlugin.instance).Info.Location), "AssetBundles", bundleName)); ShaderSwapper.UpgradeStubbedShaders(val); } catch (Exception arg) { Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}"); } loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } [Obsolete("just load from addressables")] internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_0046: 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) GameObject val = assetBundle.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent<EffectComponent>(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset<GameObject>(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } public static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)GaleShockTrooperPlugin.instance).Config; public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> result = MyConfig.Bind<T>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { } return result; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired) { } public static bool GetKeyPressed(KeyboardShortcut entry) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey); } } internal class Content { internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //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) SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); val.bodyPrefab = bodyPrefab; val.displayPrefab = displayPrefab; val.primaryColor = charColor; val.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); val.displayNameToken = tokenPrefix + "NAME"; val.descriptionToken = tokenPrefix + "DESCRIPTION"; val.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; val.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; val.desiredSortPosition = sortPosition; val.unlockableDef = unlockableDef; AddSurvivorDef(val); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; AddBuffDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal class ContentPacks : IContentPackProvider { [CompilerGenerated] private sealed class <FinalizeAsync>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; public ContentPacks <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__19 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GetContentPackAsyncArgs args; public ContentPacks <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; ContentPack.Copy(<>4__this.contentPack, args.output); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; public ContentPacks <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.contentPack.identifier = <>4__this.identifier; <>4__this.contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); <>4__this.contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); <>4__this.contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); <>4__this.contentPack.survivorDefs.Add(survivorDefs.ToArray()); <>4__this.contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); <>4__this.contentPack.skillDefs.Add(skillDefs.ToArray()); <>4__this.contentPack.skillFamilies.Add(skillFamilies.ToArray()); <>4__this.contentPack.entityStateTypes.Add(entityStates.ToArray()); <>4__this.contentPack.buffDefs.Add(buffDefs.ToArray()); <>4__this.contentPack.effectDefs.Add(effectDefs.ToArray()); <>4__this.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); <>4__this.contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs.ToArray()); <>4__this.contentPack.itemDefs.Add(itemDefs.ToArray()); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal ContentPack contentPack = new ContentPack(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<GameObject> projectilePrefabs = new List<GameObject>(); public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>(); public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<Type> entityStates = new List<Type>(); public static List<ItemDef> itemDefs = new List<ItemDef>(); public static List<BuffDef> buffDefs = new List<BuffDef>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<GameObject> networkedObjectPrefabs = new List<GameObject>(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.TheConstellate.ShockTrooper"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__18))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__18(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__19))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__19(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<FinalizeAsync>d__20))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__20(0) { <>4__this = this, args = args }; } } internal static class ItemDisplayCheck { public static List<Object> allDisplayedItems; public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "") { PrintUnused((IEnumerable<KeyAssetRuleGroup>)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable<KeyAssetRuleGroup> ruleSet = null, string bodyName = "") { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { LazyGatherAllItems(); } List<Object> list = new List<Object>(allDisplayedItems); string text2 = ""; if (ruleSet != null) { foreach (KeyAssetRuleGroup item in ruleSet) { if (item.displayRuleGroup.rules.Length != 0) { list.Remove(item.keyAsset); if (string.IsNullOrEmpty(text2)) { text2 = item.displayRuleGroup.rules[0].childName; } } } } if (string.IsNullOrEmpty(text2)) { text2 = "Chest"; } foreach (Object item2 in list) { string text3 = ""; if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static void LazyGatherAllItems() { allDisplayedItems = new List<Object>(ItemDisplays.KeyAssetDisplayPrefabs.Keys); allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return item1.name.CompareTo(item2.name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return item1.name.CompareTo(item2.name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (displayRules.Length == 0) { return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}"; } string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets[\"" + asset.name + "\"]"; for (int i = 0; i < displayRules.Length; i++) { text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )")); } return text + "\n ));"; } } internal static class ItemDisplays { private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>(); public static Dictionary<Object, ItemDisplayRule[]> KeyAssetDisplayPrefabs = new Dictionary<Object, ItemDisplayRule[]>(); public static Dictionary<string, Object> KeyAssets = new Dictionary<string, Object>(); public static int queuedDisplays; public static bool initialized = false; public static void LazyInit() { if (!initialized) { initialized = true; PopulateDisplays(); } } internal static void DisposeWhenDone() { queuedDisplays--; if (queuedDisplays <= 0 && initialized) { initialized = false; itemDisplayPrefabs = null; KeyAssetDisplayPrefabs = null; KeyAssets = null; } } internal static void PopulateDisplays() { PopulateFromBody("LoaderBody"); } private static void PopulateFromBody(string bodyName) { ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet; KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (Object.op_Implicit((Object)(object)followerPrefab)) { string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; } } } } } private static void PopulateCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false); LimbMatcher component = val.GetComponent<LimbMatcher>(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; itemDisplayPrefabs["displaylightningarmcustom"] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { return itemDisplayPrefabs[name.ToLowerInvariant()]; } Log.Error("item display " + name + " returned null"); return null; } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) if (keyAsset_ == (Object)null) { Log.Error("could not find keyasset"); } KeyAssetRuleGroup result = default(KeyAssetRuleGroup); result.keyAsset = keyAsset_; result.displayRuleGroup = new DisplayRuleGroup