Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of LonelyOperator v1.0.0
LonelyOperator.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using EntityStates; using EntityStates.Drone.Command; using EntityStates.VultureHunter.Weapon; using Grumpy; using HG.Reflection; using R2API; using R2API.Utils; using Rewired.ComponentControls.Effects; using RoR2; using RoR2.ContentManagement; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths.Version_1_35_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LonelyOperator")] [assembly: AssemblyConfiguration("Mystical")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5a6145ede521968469ce33ecb7e02baef64ccd7a")] [assembly: AssemblyProduct("LonelyOperator")] [assembly: AssemblyTitle("LonelyOperator")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LonelyOperator; [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.MysticalChicken.LonelyOperator", "Lonely Operator", "1.0.0")] public class LonelyOperatorMain : BaseUnityPlugin { public const string MODUID = "com.MysticalChicken.LonelyOperator"; public const string MODNAME = "Lonely Operator"; public const string MODVERSION = "1.0.0"; public static LonelyOperatorMain instance; public static GameObject roboBallBeamPrefab; private void Awake() { //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_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) instance = this; AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_RoboBallBuddy.RoboBallGreenBuddyBody_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { //IL_008a: 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_00a1: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) GenericSkill val11 = x.Result.AddComponent<GenericSkill>(); SkillFamily val12 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val12).name = "RoboBallGreenBuddyActivateSkillFamily"; val12.variants = (Variant[])(object)new Variant[1]; val12.defaultVariantIndex = 0u; val11.skillName = "Command Activate"; val11._skillFamily = val12; SkillDef val13 = ScriptableObject.CreateInstance<SkillDef>(); val13.skillName = "Command"; ((Object)val13).name = "RoboBallGreenCommand"; val13.skillNameToken = "ROBOBALLGREENBUDDY_COMMAND"; val13.skillDescriptionToken = "Channel a set of focusing lasers for <style=cIsDamage>3x100% damage</style>. Deals more <style=cIsDamage>damage</style> the <style=cIsUtility>longer</style> the channel. Channel duration scales with attack speed."; val13.icon = null; val13.activationState = new SerializableEntityStateType(typeof(CommandRoboBallGreenLaser)); val13.activationStateMachineName = "Weapon"; val13.interruptPriority = (InterruptPriority)8; val13.baseMaxStock = 1; val13.baseRechargeInterval = 0f; val13.attackSpeedBuffsRestockSpeed = false; val13.attackSpeedBuffsRestockSpeed_Multiplier = 1f; val13.rechargeStock = 1; val13.requiredStock = 1; val13.stockToConsume = 1; val13.dontAllowPastMaxStocks = false; val13.beginSkillCooldownOnSkillEnd = false; val13.canceledFromSprinting = false; val13.forceSprintDuringState = false; val13.fullRestockOnAssign = true; val13.resetCooldownTimerOnUse = false; val13.isCombatSkill = true; val13.mustKeyPress = true; val13.cancelSprintingOnActivation = false; val13.hideStockCount = false; val13.autoHandleLuminousShot = true; val13.isCooldownBlockedUntilManuallyReset = false; val13.keywordTokens = new string[0]; Variant[] variants2 = val12.variants; Variant val14 = new Variant { skillDef = val13, unlockableDef = null }; ((Variant)(ref val14)).viewableNode = new Node(val13.skillNameToken, false, (Node)null); variants2[0] = val14; DroneCommandReceiver val15 = x.Result.AddComponent<DroneCommandReceiver>(); CharacterBody component3 = x.Result.GetComponent<CharacterBody>(); component3.bodyFlags = (BodyFlags)(component3.bodyFlags | 0x400000); val15.followPosition = new Vector3(-4f, 4f, 3f); val15.commandSkill = val11; val15.targetType = (TargetType)4; AddAkBank(x.Result, RoR2_DLC3_VultureHunter.VultureHunterBody_prefab); Transform transform2 = ((Component)x.Result.GetComponentInChildren<CharacterModel>()).transform; if (Object.op_Implicit((Object)(object)transform2)) { ChildLocator component4 = ((Component)transform2).GetComponent<ChildLocator>(); Transform val16 = component4.FindChild("Muzzle"); if (Object.op_Implicit((Object)(object)val16)) { Transform val17 = CreateEmptyChild(val16, "CommandMuzzleGreen", Vector3.zero); RotateAroundAxis val18 = ((Component)val17).gameObject.AddComponent<RotateAroundAxis>(); val18.speed = (Speed)0; val18.slowRotationSpeed = 120f; val18.fastRotationSpeed = 720f; val18.rotateAroundAxis = (RotationAxis)2; val18.relativeTo = (Space)1; val18.reverse = true; component4.AddChild("CommandMuzzle", val17); component4.AddChild("CommandTopMuzzle", CreateEmptyChild(val17, "TopMuzzle", new Vector3(0.2887f, 0.5f, 0f))); component4.AddChild("CommandMiddleMuzzle", CreateEmptyChild(val17, "MiddleMuzzle", new Vector3(-0.5f, 0f, 0f))); component4.AddChild("CommandBottomMuzzle", CreateEmptyChild(val17, "BottomMuzzle", new Vector3(0.2887f, -0.5f, 0f))); } } }; val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_RoboBallBuddy.RoboBallRedBuddyBody_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { //IL_008a: 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_00a1: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) GenericSkill val3 = x.Result.AddComponent<GenericSkill>(); SkillFamily val4 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val4).name = "RoboBallRedBuddyActivateSkillFamily"; val4.variants = (Variant[])(object)new Variant[1]; val4.defaultVariantIndex = 0u; val3.skillName = "Command Activate"; val3._skillFamily = val4; SkillDef val5 = ScriptableObject.CreateInstance<SkillDef>(); val5.skillName = "Command"; ((Object)val5).name = "RoboBallRedCommand"; val5.skillNameToken = "ROBOBALLREDBUDDY_COMMAND"; val5.skillDescriptionToken = "Channel a set of focusing lasers for <style=cIsDamage>3x100% damage</style>. Deals more <style=cIsDamage>damage</style> the <style=cIsUtility>longer</style> the channel. Channel duration scales with attack speed."; val5.icon = null; val5.activationState = new SerializableEntityStateType(typeof(CommandRoboBallRedLaser)); val5.activationStateMachineName = "Weapon"; val5.interruptPriority = (InterruptPriority)8; val5.baseMaxStock = 1; val5.baseRechargeInterval = 0f; val5.attackSpeedBuffsRestockSpeed = false; val5.attackSpeedBuffsRestockSpeed_Multiplier = 1f; val5.rechargeStock = 1; val5.requiredStock = 1; val5.stockToConsume = 1; val5.dontAllowPastMaxStocks = false; val5.beginSkillCooldownOnSkillEnd = false; val5.canceledFromSprinting = false; val5.forceSprintDuringState = false; val5.fullRestockOnAssign = true; val5.resetCooldownTimerOnUse = false; val5.isCombatSkill = true; val5.mustKeyPress = true; val5.cancelSprintingOnActivation = false; val5.hideStockCount = false; val5.autoHandleLuminousShot = true; val5.isCooldownBlockedUntilManuallyReset = false; val5.keywordTokens = new string[0]; Variant[] variants = val4.variants; Variant val6 = new Variant { skillDef = val5, unlockableDef = null }; ((Variant)(ref val6)).viewableNode = new Node(val5.skillNameToken, false, (Node)null); variants[0] = val6; DroneCommandReceiver val7 = x.Result.AddComponent<DroneCommandReceiver>(); CharacterBody component = x.Result.GetComponent<CharacterBody>(); component.bodyFlags = (BodyFlags)(component.bodyFlags | 0x400000); val7.followPosition = new Vector3(8f, 4f, 3f); val7.commandSkill = val3; val7.targetType = (TargetType)4; AddAkBank(x.Result, RoR2_DLC3_VultureHunter.VultureHunterBody_prefab); Transform transform = ((Component)x.Result.GetComponentInChildren<CharacterModel>()).transform; if (Object.op_Implicit((Object)(object)transform)) { ChildLocator component2 = ((Component)transform).GetComponent<ChildLocator>(); Transform val8 = component2.FindChild("Muzzle"); if (Object.op_Implicit((Object)(object)val8)) { Transform val9 = CreateEmptyChild(val8, "CommandMuzzleRed", Vector3.zero); RotateAroundAxis val10 = ((Component)val9).gameObject.AddComponent<RotateAroundAxis>(); val10.speed = (Speed)0; val10.slowRotationSpeed = 120f; val10.fastRotationSpeed = 720f; val10.rotateAroundAxis = (RotationAxis)2; val10.relativeTo = (Space)1; val10.reverse = false; component2.AddChild("CommandMuzzle", val9); component2.AddChild("CommandTopMuzzle", CreateEmptyChild(val9, "TopMuzzle", new Vector3(-0.2887f, 0.5f, 0f))); component2.AddChild("CommandMiddleMuzzle", CreateEmptyChild(val9, "MiddleMuzzle", new Vector3(0.5f, 0f, 0f))); component2.AddChild("CommandBottomMuzzle", CreateEmptyChild(val9, "BottomMuzzle", new Vector3(-0.2887f, -0.5f, 0f))); } } }; val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC3_VultureHunter.BeamVultureHunterSolus_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { roboBallBeamPrefab = PrefabAPI.InstantiateClone(x.Result, "RoboBallBuddyBeamProjectile"); NetworkIdentity val2 = default(NetworkIdentity); if (!roboBallBeamPrefab.TryGetComponent<NetworkIdentity>(ref val2)) { roboBallBeamPrefab.AddComponent<NetworkIdentity>(); } }; Content.entityStates.Add(typeof(CommandRoboBallLaserBase)); Content.entityStates.Add(typeof(CommandRoboBallGreenLaser)); Content.entityStates.Add(typeof(CommandRoboBallRedLaser)); new Content().Initialize(); } public static void AddAkBank(GameObject prefab, string bodyPath) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) AkBank bank = prefab.AddComponent<AkBank>(); AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(bodyPath), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle<GameObject> x) { AkBank component = x.Result.GetComponent<AkBank>(); if (Object.op_Implicit((Object)(object)component)) { bank.data.WwiseObjectReference = component.data.WwiseObjectReference; } }; } public static Transform CreateEmptyChild(Transform parent, string name, Vector3 position) { //IL_0002: 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) Transform transform = new GameObject(name).transform; transform.SetParent(parent, false); ((Component)transform).transform.localPosition = position; return transform; } } internal class Content : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List<Type> entityStates = new List<Type>(); public string identifier => "com.MysticalChicken.LonelyOperator"; 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); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.entityStateTypes.Add(entityStates.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public class CommandRoboBallGreenLaser : CommandRoboBallLaserBase { public override RoboBallType roboBallType => RoboBallType.Green; } public class CommandRoboBallRedLaser : CommandRoboBallLaserBase { public override RoboBallType roboBallType => RoboBallType.Red; } public class CommandRoboBallLaserBase : BaseCommandState { public enum RoboBallType { None, Green, Red } public class LaserHandle { public Transform muzzleTransform; public GameObject laserEffect; public EffectManagerHelper _emh_laserEffect; public Transform laserEffectEnd; public string muzzleChildLocatorName; public void DisposeLaserEffect() { if (Object.op_Implicit((Object)(object)laserEffect)) { if ((Object)(object)_emh_laserEffect != (Object)null && _emh_laserEffect.OwningPool != null) { ((GenericPool<EffectManagerHelper>)(object)_emh_laserEffect.OwningPool).ReturnObject(_emh_laserEffect); } else { EntityState.Destroy((Object)(object)laserEffect); } _emh_laserEffect = null; laserEffect = null; } } } public float startingAngle; [SerializeField] public GameObject effectPrefab; [SerializeField] public GameObject hitEffectPrefab; [SerializeField] public GameObject laserPrefab; public static string playLoopSoundString = FireSolusLaser.playLoopSoundString; public static string stopLoopSoundString = FireSolusLaser.stopLoopSoundString; public static float damageCoefficientPerSecond = 3f; public static float force = 100f; public static float minSpread = 0f; public static float maxSpread = 0f; public static int bulletCount = 1; public static float baseFireFrequency = 3f; public static float maxDistance = 500f; public static float startOffsetDistance = 30f; public static float targetingSmoothTime = 0.15f; public static AnimationCurve targetingSmoothCurve = FireSolusLaser.targetingSmoothCurve; public static float lockOnDuration = 1f; public static float baseDuration = 5f; public static float procCoefficientPerTick = 0.333f; public static int triggerToNext; private float fireStopwatch; private float stopwatch; private Ray aimRay; private Transform modelTransform; private BulletAttack bulletAttack; private LaserHandle laser1; private LaserHandle laser2; private LaserHandle laser3; private float currentTargetDistance = startOffsetDistance; private float targetingSmoothVelocity; private bool isCrit; public static AnimationCurve bounceCurve = FireSolusLaser.bounceCurve; public static AnimationCurve adjustCurveX = FireSolusLaser.adjustCurveX; public static AnimationCurve adjustCurveZ = FireSolusLaser.adjustCurveZ; public static float adjustZ = FireSolusLaser.adjustZ; public float rotateL; public float rotateR; private int laserIndex; private static int numLasers = 3; private float fireFrequency; private ChildLocator childLocator; private RotateAroundAxis commandRotation; private bool startedRotation; private float duration; public static string muzzleName = "Muzzle"; public virtual RoboBallType roboBallType { get; set; } = RoboBallType.None; public override float CommandDuration => duration; public override void OnEnter() { //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_001f: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) effectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Golem/MuzzleflashGolem.prefab").WaitForCompletion(); hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/Hitspark1.prefab").WaitForCompletion(); laserPrefab = LonelyOperatorMain.roboBallBeamPrefab; base.shouldFollow = true; base.shouldOccupySpace = false; ((BaseCommandState)this).OnEnter(); duration = Mathf.Max(baseDuration * ((BaseCommandState)this).GetAttackerBody().attackSpeed, baseDuration); base.followTime = duration; base.breakAwayDuration = 1f; fireFrequency = baseFireFrequency * (float)numLasers; Util.PlaySound(playLoopSoundString, ((EntityState)this).gameObject); Util.PlaySound("Play_alloyHunter_pauldronLasers_04_activateLasers", ((EntityState)this).gameObject); aimRay = ((BaseState)this).GetAimRay(); UpdateTargetDistance(aimRay, force: true); currentTargetDistance += startOffsetDistance; modelTransform = ((EntityState)this).GetModelTransform(); if (Object.op_Implicit((Object)(object)modelTransform)) { childLocator = ((EntityState)this).GetModelChildLocator(); if (Object.op_Implicit((Object)(object)childLocator)) { laser1 = CreateLaserEffects(childLocator, "CommandMiddleMuzzle"); laser2 = CreateLaserEffects(childLocator, "CommandTopMuzzle"); laser3 = CreateLaserEffects(childLocator, "CommandBottomMuzzle"); Transform obj = childLocator.FindChild("CommandMuzzle"); commandRotation = ((obj != null) ? ((Component)obj).GetComponent<RotateAroundAxis>() : null); } } } private LaserHandle CreateLaserEffects(ChildLocator childLocator, string muzzleName) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) LaserHandle laserHandle = new LaserHandle(); laserHandle.muzzleTransform = childLocator.FindChild(muzzleName); laserHandle.laserEffect = null; laserHandle._emh_laserEffect = null; laserHandle.laserEffectEnd = null; if (Object.op_Implicit((Object)(object)laserHandle.muzzleTransform) && Object.op_Implicit((Object)(object)laserPrefab)) { if (!EffectManager.ShouldUsePooledEffect(laserPrefab)) { laserHandle.laserEffect = Object.Instantiate<GameObject>(laserPrefab, laserHandle.muzzleTransform.position, laserHandle.muzzleTransform.rotation); } else { laserHandle._emh_laserEffect = EffectManager.GetAndActivatePooledEffect(laserPrefab, laserHandle.muzzleTransform.position, laserHandle.muzzleTransform.rotation); laserHandle.laserEffect = ((Component)laserHandle._emh_laserEffect).gameObject; } laserHandle.muzzleChildLocatorName = muzzleName; ChildLocator component = laserHandle.laserEffect.GetComponent<ChildLocator>(); laserHandle.laserEffectEnd = component.FindChild("LaserEnd"); } return laserHandle; } public override void OnExit() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) laser1.DisposeLaserEffect(); laser2.DisposeLaserEffect(); laser3.DisposeLaserEffect(); if (Object.op_Implicit((Object)(object)commandRotation)) { commandRotation.SetSpeed((Speed)0); ((Component)commandRotation).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); } Util.PlaySound(stopLoopSoundString, ((EntityState)this).gameObject); ((BaseCommandState)this).OnExit(); } private void DisposeLaserEffect(GameObject laserEffect, EffectManagerHelper _emh_laserEffect) { if (Object.op_Implicit((Object)(object)laserEffect)) { if ((Object)(object)_emh_laserEffect != (Object)null && _emh_laserEffect.OwningPool != null) { ((GenericPool<EffectManagerHelper>)(object)_emh_laserEffect.OwningPool).ReturnObject(_emh_laserEffect); } else { EntityState.Destroy((Object)(object)laserEffect); } _emh_laserEffect = null; laserEffect = null; } } public override void FixedUpdate() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0147: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) ((BaseCommandState)this).FixedUpdate(); float deltaTime = ((EntityState)this).GetDeltaTime(); fireStopwatch += deltaTime; stopwatch += deltaTime; aimRay = ((BaseCommandState)this).GetAttackerBody().inputBank.GetAimRay(); HurtBox val = null; Vector3 val2; if (stopwatch >= lockOnDuration) { if (!startedRotation) { startedRotation = true; BeginRotation(); } UpdateRotation(); val = SearchForTarget(aimRay, 100f, 5f); if (Object.op_Implicit((Object)(object)val)) { ref Ray reference = ref aimRay; val2 = ((Component)val).transform.position - ((Ray)(ref aimRay)).origin; ((Ray)(ref reference)).direction = ((Vector3)(ref val2)).normalized; } } RaycastHit val3 = default(RaycastHit); if (!Object.op_Implicit((Object)(object)val) && Util.CharacterRaycast(((EntityState)this).gameObject, aimRay, ref val3, maxDistance, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0)) { ref Ray reference2 = ref aimRay; val2 = ((RaycastHit)(ref val3)).point - ((Ray)(ref aimRay)).origin; ((Ray)(ref reference2)).direction = ((Vector3)(ref val2)).normalized; } UpdateTargetDistance(aimRay); float num = 1f / (fireFrequency * Mathf.Lerp(1f, 3f, Mathf.Clamp01((stopwatch - lockOnDuration - 1f) / (10f - lockOnDuration)))); bool flag = fireStopwatch > num; float num2 = adjustCurveX.Evaluate(stopwatch / (lockOnDuration * 2f)); float num3 = adjustCurveZ.Evaluate(stopwatch / (lockOnDuration * 2f)); RoboBallType roboBallType = this.roboBallType; if (1 == 0) { } float num4 = roboBallType switch { RoboBallType.Green => 0f - num2, RoboBallType.Red => num2, _ => 0f, }; if (1 == 0) { } float yRotate = num4; do { if (flag) { isCrit = ((BaseCommandState)this).GetAttackerBody().RollCrit(); } UpdateLaser(aimRay, laser1, flag && laserIndex == 0, yRotate, num3); UpdateLaser(aimRay, laser2, flag && laserIndex == 1, yRotate, num3 - adjustZ); UpdateLaser(aimRay, laser3, flag && laserIndex == 2, yRotate, num3 + adjustZ); if (flag) { laserIndex++; fireStopwatch -= num; if (laserIndex >= numLasers) { laserIndex = 0; } } } while (fireStopwatch > num); if (((EntityState)this).isAuthority && stopwatch > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } private void BeginRotation() { if (Object.op_Implicit((Object)(object)commandRotation)) { commandRotation.fastRotationSpeed = commandRotation.slowRotationSpeed; commandRotation.SetSpeed((Speed)2); } } private void UpdateRotation() { if (Object.op_Implicit((Object)(object)commandRotation)) { commandRotation.fastRotationSpeed = Mathf.Lerp(commandRotation.slowRotationSpeed, commandRotation.slowRotationSpeed * 9f, Mathf.Clamp01((stopwatch - lockOnDuration - 1f) / (10f - lockOnDuration))); } } private HurtBox SearchForTarget(Ray aimRay, float searchDistance, float searchAngle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) BullseyeSearch val = new BullseyeSearch(); val.searchOrigin = ((Ray)(ref aimRay)).origin; val.searchDirection = ((Ray)(ref aimRay)).direction; val.maxDistanceFilter = searchDistance; val.maxAngleFilter = searchAngle; val.teamMaskFilter = TeamMask.GetEnemyTeams(((EntityState)this).teamComponent.teamIndex); val.sortMode = (SortMode)2; val.RefreshCandidates(); HurtBox val2 = val.GetResults().FirstOrDefault(); if (Object.op_Implicit((Object)(object)val2)) { return val2; } return null; } private void UpdateTargetDistance(Ray aimRay, bool force = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) float distance = maxDistance; RaycastHit val = default(RaycastHit); if (Physics.Raycast(aimRay, ref val, maxDistance, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask), (QueryTriggerInteraction)0)) { distance = ((RaycastHit)(ref val)).distance; } if (force) { currentTargetDistance = distance; } else { currentTargetDistance = Mathf.SmoothDamp(currentTargetDistance, distance, ref targetingSmoothVelocity, targetingSmoothTime * targetingSmoothCurve.Evaluate(((EntityState)this).fixedAge / lockOnDuration)); } } private void UpdateLaser(Ray aimRay, LaserHandle laserHandle, bool shouldFire, float yRotate, float zRotate) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0080: 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_0094: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) Vector3 point = ((Ray)(ref aimRay)).GetPoint(currentTargetDistance); Ray val = aimRay; if (Object.op_Implicit((Object)(object)laserHandle.muzzleTransform)) { ((Ray)(ref val))..ctor(laserHandle.muzzleTransform.position, point - laserHandle.muzzleTransform.position); } Vector3 val2 = Vector3.up - Vector3.Project(((Ray)(ref val)).direction, Vector3.up); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 direction = ((Ray)(ref val)).direction; ((Ray)(ref val)).direction = Quaternion.AngleAxis(yRotate, normalized) * ((Ray)(ref val)).direction; ((Ray)(ref val)).direction = Quaternion.AngleAxis(zRotate, direction) * ((Ray)(ref val)).direction; Vector3 origin = ((Ray)(ref val)).origin; Vector3 point2 = ((Ray)(ref val)).GetPoint(maxDistance); bool flag = false; if (Object.op_Implicit((Object)(object)laserHandle.laserEffect)) { RaycastHit val3 = default(RaycastHit); if (Util.CharacterRaycast(((EntityState)this).gameObject, val, ref val3, maxDistance, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0)) { point2 = ((RaycastHit)(ref val3)).point; RaycastHit val4 = default(RaycastHit); if (Util.CharacterRaycast(((EntityState)this).gameObject, new Ray(((RaycastHit)(ref val3)).point - ((Ray)(ref val)).direction * 0.1f, -((Ray)(ref val)).direction), ref val4, ((RaycastHit)(ref val3)).distance, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0)) { point2 = ((Ray)(ref val)).GetPoint(0.1f); flag = true; } } laserHandle.laserEffect.transform.rotation = Util.QuaternionSafeLookRotation(point2 - origin); laserHandle.laserEffect.transform.position = laserHandle.muzzleTransform.position; laserHandle.laserEffectEnd.position = point2; } if (shouldFire && !flag) { Transform obj = modelTransform; Ray val5 = val; string muzzleChildLocatorName = laserHandle.muzzleChildLocatorName; val2 = point2 - ((Ray)(ref val)).origin; FireBullet(obj, val5, muzzleChildLocatorName, ((Vector3)(ref val2)).magnitude + 1f); } } 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; } private void FireBullet(Transform modelTransform, Ray aimRay, string targetMuzzle, float maxDistance) { //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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (((EntityState)this).isAuthority) { GameObject owner = (Object.op_Implicit((Object)(object)base.commandReceiver.leaderBody) ? ((Component)base.commandReceiver.leaderBody).gameObject : ((EntityState)this).gameObject); float damage = ((BaseCommandState)this).GetAttackerBody().damage; if (bulletAttack == null) { bulletAttack = new BulletAttack(); bulletAttack.owner = owner; bulletAttack.weapon = ((EntityState)this).gameObject; bulletAttack.minSpread = minSpread; bulletAttack.maxSpread = maxSpread; bulletAttack.bulletCount = 1u; bulletAttack.hitEffectPrefab = hitEffectPrefab; bulletAttack.procCoefficient = procCoefficientPerTick; bulletAttack.falloffModel = (FalloffModel)0; bulletAttack.radius = 1f; bulletAttack.force = force; } bulletAttack.origin = ((Ray)(ref aimRay)).origin; bulletAttack.aimVector = ((Ray)(ref aimRay)).direction; bulletAttack.damage = damageCoefficientPerSecond * damage / (baseFireFrequency * (float)numLasers); bulletAttack.damageType = DamageTypeCombo.GenericSecondary; bulletAttack.muzzleName = targetMuzzle; bulletAttack.isCrit = isCrit; bulletAttack.HitEffectNormal = false; bulletAttack.maxDistance = maxDistance; bulletAttack.Fire(); } } public override void OnSerialize(NetworkWriter writer) { ((BaseCommandState)this).OnSerialize(writer); writer.Write(stopwatch); } public override void OnDeserialize(NetworkReader reader) { ((BaseCommandState)this).OnDeserialize(reader); stopwatch = reader.ReadSingle(); } }