Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BetterSonLaser v1.0.2
plugins/BetterSonLaser.dll
Decompiled 6 months agousing 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 System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ConcentricContent; using EntityStates; using EntityStates.FalseSon; using HarmonyLib; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2.Skills; using RoR2.UI; using RoR2.WwiseUtils; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BetterSonLaser")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7af64e81ea9d0685548e9df4a66c5f723e860f25")] [assembly: AssemblyProduct("BetterSonLaser")] [assembly: AssemblyTitle("BetterSonLaser")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace BetterSonLaser { public class BetterLaserCharge : BaseSkillState { public float baseChargeDuration = 2f; public GameObject chargeCompletePrefab; public static float minChargeForChargedAttack = 0f; public static GameObject chargeVfxPrefab; public static string chargeVfxChildLocatorName = "HandL"; public static GameObject crosshairOverridePrefab; public static float walkSpeedCoefficient = 0.55f; public static string startChargeLoopSFXString = "Play_falseson_skill4_laser_charge_loop"; public static string endChargeLoopSFXString = "Stop_falseson_skill4_laser_charge_loop"; public static string enterSFXString = ""; private OverrideRequest crosshairOverrideRequest; private Transform chargeVfxInstanceTransform; private int gauntlet; private uint soundID; public static float baseDuration = 3f; public static float laserMaxWidth = 0.2f; public static GameObject effectPrefab; public static GameObject laserPrefab; public static string attackSoundString = ""; private float duration; private uint chargePlayID; private GameObject chargeEffect; private GameObject laserEffect; private LineRenderer laserLineComponent; private Vector3 laserDirection; private Vector3 visualEndPosition; private float flashTimer; private bool laserOn; private bool chargeAnimPlayed; private bool chargeFinished; private bool chargeStarted; private bool cancellingAttack; public static GameObject doneChargingEffect; protected float chargeDuration { get; private set; } protected float charge { get; private set; } public override void OnEnter() { //IL_00c1: 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_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) ((BaseState)this).OnEnter(); chargeDuration = baseChargeDuration / ((BaseState)this).attackSpeedStat; soundID = Util.PlaySound(startChargeLoopSFXString, ((EntityState)this).gameObject); duration = baseDuration / ((BaseState)this).attackSpeedStat; Transform modelTransform = ((EntityState)this).GetModelTransform(); chargePlayID = Util.PlayAttackSpeedSound(attackSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); if (Object.op_Implicit((Object)(object)modelTransform)) { ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform val = component.FindChild("MuzzleLaser"); if (Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)effectPrefab)) { chargeEffect = Object.Instantiate<GameObject>(effectPrefab, val.position, val.rotation); chargeEffect.transform.parent = val; ScaleParticleSystemDuration component2 = chargeEffect.GetComponent<ScaleParticleSystemDuration>(); if (Object.op_Implicit((Object)(object)component2)) { component2.newDuration = duration; } } if (Object.op_Implicit((Object)(object)laserPrefab)) { laserEffect = Object.Instantiate<GameObject>(laserPrefab, val.position, val.rotation); laserEffect.transform.parent = val; laserLineComponent = laserEffect.GetComponent<LineRenderer>(); } } } } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.SetAimTimer(duration); } flashTimer = 0f; laserOn = 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)2; } public override void ModifyNextState(EntityState nextState) { ((EntityState)this).ModifyNextState(nextState); LaserFatherCharged val = (LaserFatherCharged)(object)((nextState is LaserFatherCharged) ? nextState : null); cancellingAttack = val == null; } public override void OnExit() { if (Object.op_Implicit((Object)(object)chargeVfxInstanceTransform)) { EntityState.Destroy((Object)(object)((Component)chargeVfxInstanceTransform).gameObject); OverrideRequest obj = crosshairOverrideRequest; if (obj != null) { obj.Dispose(); } chargeVfxInstanceTransform = null; } ((EntityState)this).PlayAnimation("Gesture, Additive", "Empty"); ((EntityState)this).PlayAnimation("Gesture, Override", "Empty"); if (cancellingAttack) { ((EntityState)this).PlayAnimation("Gesture, Head, Additive", "Empty"); ((EntityState)this).PlayAnimation("Gesture, Head, Override", "Buffer Empty"); } ((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 1f; Util.PlaySound(endChargeLoopSFXString, ((EntityState)this).gameObject); AkSoundEngine.StopPlayingID(chargePlayID); Util.PlaySound("Stop_falseson_skill4_laser_loop", ((EntityState)this).gameObject); Util.PlaySound("Stop_falseson_skill4_laser_charge_loop", ((EntityState)this).gameObject); ((EntityState)this).OnExit(); if (Object.op_Implicit((Object)(object)chargeEffect)) { EntityState.Destroy((Object)(object)chargeEffect); } if (Object.op_Implicit((Object)(object)laserEffect)) { EntityState.Destroy((Object)(object)laserEffect); } } public override void FixedUpdate() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); charge = Mathf.Clamp01(((EntityState)this).fixedAge / chargeDuration); AkSoundEngine.SetRTPCValueByPlayingID("charFalseSon_skill4_chargeAmount", charge * 100f, soundID); ((EntityState)this).characterBody.SetSpreadBloom(charge, true); ((EntityState)this).characterBody.SetAimTimer(3f); if (charge >= minChargeForChargedAttack && !chargeStarted) { chargeStarted = true; ((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = walkSpeedCoefficient; ((EntityState)this).PlayCrossfade("Gesture, Head, Additive", "LaserChargeIntro", "LaserChargeIntro.playbackRate", 0.2f * chargeDuration, 0.1f); ((EntityState)this).PlayCrossfade("Gesture, Head, Override", "LaserChargeIntro", "LaserChargeIntro.playbackRate", 0.2f * chargeDuration, 0.1f); } if (((EntityState)this).isAuthority) { AuthorityFixedUpdate(); } if (!(charge > 0.85f) || chargeFinished) { return; } ChildLocator component = ((Component)((EntityState)this).GetModelTransform()).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform val = component.FindChild("MuzzleLaser"); if (Object.op_Implicit((Object)(object)val)) { EffectManager.SpawnEffect(doneChargingEffect, new EffectData { origin = ((Component)val).transform.position, scale = 1f }, true); chargeFinished = true; } } } public override void Update() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_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) ((EntityState)this).Update(); Mathf.Clamp01(((EntityState)this).age / chargeDuration); if (!BetterLaserSkill.enableTracer.Value || !Object.op_Implicit((Object)(object)laserEffect) || !Object.op_Implicit((Object)(object)laserLineComponent)) { return; } float num = 1000f; Ray aimRay = ((BaseState)this).GetAimRay(); Vector3 position = laserEffect.transform.parent.position; Vector3 point = ((Ray)(ref aimRay)).GetPoint(num); laserDirection = point - position; Ray val = aimRay; LayerIndex val2 = LayerIndex.world; int num2 = LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask); val2 = LayerIndex.entityPrecise; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ref val3, num, num2 | LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask))) { point = ((RaycastHit)(ref val3)).point; } laserLineComponent.SetPosition(0, position); laserLineComponent.SetPosition(1, point); float num3; if (duration - ((EntityState)this).age > 0.5f) { num3 = ((EntityState)this).age / duration; } else { flashTimer -= Time.deltaTime; if (flashTimer <= 0f) { laserOn = !laserOn; flashTimer = 1f / 30f; } num3 = (laserOn ? 1f : 0f); } num3 *= 0.2f; laserLineComponent.startWidth = num3; laserLineComponent.endWidth = num3; } private void AuthorityFixedUpdate() { if (!((BaseSkillState)this).IsKeyDownAuthority()) { ((EntityState)this).outer.SetNextState(GetNextStateAuthority()); } } protected virtual EntityState GetNextStateAuthority() { if (charge < 0.175f) { charge = 0.175f; } return (EntityState)(object)new BetterLaserFire { charge = charge, walkSpeedCoefficient = walkSpeedCoefficient }; } } public class BetterLaserFire : BaseSkillState { public static GameObject effectPrefab; public GameObject hitEffectPrefab = null; public static GameObject laserPrefab; public static string playAttackSoundString = "Play_falseson_skill4_laser_start"; public static string playLoopSoundString = "Play_falseson_skill4_laser_charge_loop"; public static string stopLoopSoundString = "Stop_falseson_skill4_laser_charge_loop"; public static float damageCoefficient = 1.75f; public static float force = 100f; public static float minSpread = 0f; public static float maxSpread = 0f; public static int bulletCount = 1; public static float fireFrequency = 12f; public static float maxDistance = 2000f; public static float minimumDuration = 3f; public static float maximumDuration = 4f; public static float lockOnAngle = 3f; public static float procCoefficientPerTick = 0.45f; private HurtBox lockedOnHurtBox; private float fireStopwatch; private float stopwatch; private float refillSecondaryStopwatch; private float maxSecondaryStock; private float secondaryStock; private Ray aimRay; private Transform modelTransform; private GameObject laserEffect; private ChildLocator laserChildLocator; private Transform laserEffectEnd; public float charge; protected Transform muzzleTransform; private float bonusDuration; protected AimRequest aimRequest; public static int abilityAimType = 2; private float duration; public float walkSpeedCoefficient = 1f; private int lunarSpikeCount; public static event Action<float> laserTracking; public override void OnEnter() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); int maxStock = ((EntityState)this).skillLocator.secondary.maxStock; float num = (float)(maxStock - 4) * 0.4f; duration = maximumDuration + num; aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)abilityAimType); ((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = walkSpeedCoefficient; FalseSonController component = ((EntityState)this).GetComponent<FalseSonController>(); Util.PlaySound("Play_falseson_skill4_laser_start", ((EntityState)this).gameObject); ((EntityState)this).PlayCrossfade("Gesture, Head, Override", "FireLaserLoop", 0.25f); ((EntityState)this).PlayCrossfade("Gesture, Head, Additive", "FireLaserLoop", 0.25f); aimRay = ((BaseState)this).GetAimRay(); TrajectoryAimAssist.ApplyTrajectoryAimAssist(ref aimRay, maxDistance, ((EntityState)this).gameObject, 1f); modelTransform = ((EntityState)this).GetModelTransform(); if (Object.op_Implicit((Object)(object)modelTransform)) { ChildLocator component2 = ((Component)modelTransform).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)component2)) { muzzleTransform = component2.FindChild("MuzzleLaser"); if (Object.op_Implicit((Object)(object)muzzleTransform) && Object.op_Implicit((Object)(object)laserPrefab)) { laserEffect = Object.Instantiate<GameObject>(laserPrefab, muzzleTransform.position, muzzleTransform.rotation); laserEffect.transform.parent = muzzleTransform; laserChildLocator = laserEffect.GetComponent<ChildLocator>(); laserEffectEnd = laserChildLocator.FindChild("LaserEnd"); } } } bonusDuration = 0f; for (int i = 1; i <= lunarSpikeCount; i++) { bonusDuration += 1f / (0.5f * (float)i + 1f); } if (bonusDuration < 0f) { bonusDuration = 0f; } duration += bonusDuration; ((EntityState)this).characterBody.SetAimTimer(duration); float num2 = ((EntityState)this).characterBody.attackSpeed - ((EntityState)this).characterBody.baseAttackSpeed; fireFrequency += num2 * 0.3f; maxSecondaryStock = ((EntityState)this).skillLocator.GetSkill((SkillSlot)1).maxStock; secondaryStock = ((EntityState)this).skillLocator.GetSkill((SkillSlot)1).maxStock; } public override void OnExit() { AimRequest obj = aimRequest; if (obj != null) { obj.Dispose(); } if (Object.op_Implicit((Object)(object)laserEffect)) { EntityState.Destroy((Object)(object)laserEffect); } ((EntityState)this).characterMotor.walkSpeedPenaltyCoefficient = 1f; ((EntityState)this).characterBody.SetAimTimer(2f); Util.PlaySound("Stop_falseson_skill4_laser_loop", ((EntityState)this).gameObject); Util.PlaySound("Stop_falseson_skill4_laser_charge_loop", ((EntityState)this).gameObject); Util.PlaySound("Play_falseson_skill4_laser_end", ((EntityState)this).gameObject); ((EntityState)this).PlayAnimation("Gesture, Head, Override", "FireLaserLoopEnd"); ((EntityState)this).PlayAnimation("Gesture, Head, Additive", "FireLaserLoopEnd"); ((EntityState)this).OnExit(); } public override void FixedUpdate() { //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_013e: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_019d: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); float deltaTime = ((EntityState)this).GetDeltaTime(); fireStopwatch += deltaTime; stopwatch += deltaTime; refillSecondaryStopwatch += deltaTime; if (refillSecondaryStopwatch > 1f) { maxSecondaryStock = ((EntityState)this).skillLocator.GetSkill((SkillSlot)1).maxStock; secondaryStock = ((EntityState)this).skillLocator.GetSkill((SkillSlot)1).stock; if (secondaryStock < maxSecondaryStock) { GenericSkill skill = ((EntityState)this).skillLocator.GetSkill((SkillSlot)1); int stock = skill.stock; skill.stock = stock + 1; refillSecondaryStopwatch = 0f; } } aimRay = ((BaseState)this).GetAimRay(); Vector3 val = ((Ray)(ref aimRay)).origin; if (Object.op_Implicit((Object)(object)muzzleTransform)) { val = muzzleTransform.position; } Vector3 val2; LayerIndex val4; if (Object.op_Implicit((Object)(object)lockedOnHurtBox)) { val2 = ((Component)lockedOnHurtBox).transform.position; } else { TrajectoryAimAssist.ApplyTrajectoryAimAssist(ref aimRay, maxDistance, ((EntityState)this).gameObject, 1f); GameObject gameObject = ((EntityState)this).gameObject; Ray val3 = aimRay; float num = maxDistance; val4 = LayerIndex.world; int num2 = LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask); val4 = LayerIndex.entityPrecise; RaycastHit val5 = default(RaycastHit); val2 = ((!Util.CharacterRaycast(gameObject, val3, ref val5, num, LayerMask.op_Implicit(num2 | LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask)), (QueryTriggerInteraction)1)) ? ((Ray)(ref aimRay)).GetPoint(maxDistance) : ((RaycastHit)(ref val5)).point); } Ray val6 = default(Ray); ((Ray)(ref val6))..ctor(val, val2 - val); bool flag = false; Vector3 val8; if (Object.op_Implicit((Object)(object)laserEffect) && Object.op_Implicit((Object)(object)laserChildLocator)) { GameObject gameObject2 = ((EntityState)this).gameObject; Ray val7 = val6; val8 = val2 - val; float magnitude = ((Vector3)(ref val8)).magnitude; val4 = LayerIndex.world; int num3 = LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask); val4 = LayerIndex.entityPrecise; RaycastHit val9 = default(RaycastHit); if (Util.CharacterRaycast(gameObject2, val7, ref val9, magnitude, LayerMask.op_Implicit(num3 | LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask)), (QueryTriggerInteraction)0)) { val2 = ((RaycastHit)(ref val9)).point; GameObject gameObject3 = ((EntityState)this).gameObject; Ray val10 = new Ray(val2 - ((Ray)(ref val6)).direction * 0.1f, -((Ray)(ref val6)).direction); float distance = ((RaycastHit)(ref val9)).distance; val4 = LayerIndex.world; int num4 = LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask); val4 = LayerIndex.entityPrecise; RaycastHit val11 = default(RaycastHit); if (Util.CharacterRaycast(gameObject3, val10, ref val11, distance, LayerMask.op_Implicit(num4 | LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask)), (QueryTriggerInteraction)0)) { val2 = ((Ray)(ref val6)).GetPoint(0.1f); flag = true; } } laserEffect.transform.rotation = Util.QuaternionSafeLookRotation(val2 - val); ((Component)laserEffectEnd).transform.position = val2; } if (fireStopwatch > 1f / fireFrequency) { string targetMuzzle = "MuzzleLaser"; if (!flag) { Transform obj = modelTransform; Ray val12 = val6; val8 = val2 - ((Ray)(ref val6)).origin; FireBullet(obj, val12, targetMuzzle, ((Vector3)(ref val8)).magnitude + 0.1f); } fireStopwatch -= 1f / fireFrequency; } if (((EntityState)this).isAuthority && stopwatch > 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; } private void FireBullet(Transform modelTransform, Ray aimRay, string targetMuzzle, float maxDistance) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)effectPrefab)) { EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, targetMuzzle, false); } if (((EntityState)this).isAuthority) { if (charge > 0.85f) { charge = 1f; } BulletAttack val = new BulletAttack(); val.owner = ((EntityState)this).gameObject; val.weapon = ((EntityState)this).gameObject; val.origin = ((Ray)(ref aimRay)).origin; val.aimVector = ((Ray)(ref aimRay)).direction; val.minSpread = minSpread; val.maxSpread = maxSpread; val.bulletCount = 1u; val.damage = damageCoefficient * ((BaseState)this).damageStat * charge; val.force = force; val.muzzleName = targetMuzzle; val.hitEffectPrefab = hitEffectPrefab; val.isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master); val.procCoefficient = procCoefficientPerTick; val.HitEffectNormal = false; val.radius = 1f; val.maxDistance = maxDistance; val.damageType.damageSource = (DamageSource)8; val.Fire(); } } public override void OnSerialize(NetworkWriter writer) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) ((BaseSkillState)this).OnSerialize(writer); NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(lockedOnHurtBox)); writer.Write(stopwatch); } public override void OnDeserialize(NetworkReader reader) { //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) ((BaseSkillState)this).OnDeserialize(reader); HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader); stopwatch = reader.ReadSingle(); GameObject obj = ((HurtBoxReference)(ref val)).ResolveGameObject(); lockedOnHurtBox = ((obj != null) ? obj.GetComponent<HurtBox>() : null); } } public class BetterLaserSkill : Concentric, ISkill, IGenericObject, IGameObject { private SkillFamily sonSpecial; public static ConfigEntry<bool> enableTracer = ((BaseUnityPlugin)BetterSonLaserPlugin.instance).Config.Bind<bool>("Settings", "Enable Tracer", true, "Enable the golem-tracer when charging the skill"); public override async Task Initialize() { await <>n__0(); sonSpecial = await BetterSonLaserPlugin.LoadAsset<SkillFamily>("RoR2/DLC2/FalseSon/FalseSonBodySpecialFamily.asset"); Variant[] variants = sonSpecial.variants; variants[0] = await AssetExtensionMethods.GetSkillFamilyVariant<BetterLaserSkill>(this); BetterLaserCharge.laserPrefab = await AssetExtensionMethods.GetGenericObject<BetterLaserSkill>(this); BetterLaserCharge.effectPrefab = await Concentric.GetGenericObject<BetterLaserChargeEffect>(); BetterLaserCharge.crosshairOverridePrefab = await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/Base/UI/StraightBracketCrosshair.prefab"); BetterLaserCharge.chargeVfxPrefab = await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/DLC2/FalseSon/FalseSonFistCharge.prefab"); BetterLaserCharge.doneChargingEffect = await Concentric.GetEffect<WhyDoesGearboxUseLegacyResourcesAPI>(); BetterLaserFire.laserPrefab = await Concentric.GetGenericObject<BetterLaserFirePrefab>(); BetterLaserFire.effectPrefab = await Concentric.GetEffect<BetterLaserFireMuzzleFlash>(); } async Task<SkillDef> ISkill.BuildObject() { SkillDef skill = ScriptableObject.CreateInstance<SkillDef>(); skill.skillName = "Special 1"; skill.skillNameToken = "FALSESON_SPECIAL_NAME"; skill.skillDescriptionToken = "FALSESON_SPECIAL_DESCRIPTION"; SkillDef val = skill; val.icon = await BetterSonLaserPlugin.LoadAsset<Sprite>("sondle:texFalseSonSkillIcons_3"); skill.activationStateMachineName = "Weapon"; skill.interruptPriority = (InterruptPriority)2; skill.baseRechargeInterval = 15f; skill.resetCooldownTimerOnUse = true; skill.fullRestockOnAssign = false; skill.dontAllowPastMaxStocks = false; skill.beginSkillCooldownOnSkillEnd = true; skill.cancelSprintingOnActivation = true; skill.isCombatSkill = true; skill.mustKeyPress = true; skill.autoHandleLuminousShot = true; skill.keywordTokens = new string[1] { "KEYWORD_GROWTH" }; return skill; } async Task<GameObject> IGenericObject.BuildObject() { Material sonTracer = new Material(await BetterSonLaserPlugin.LoadAsset<Material>("RoR2/Base/Common/VFX/matGolemLaserIndicator.mat")); Material val = sonTracer; val.SetTexture("_RemapTex", (Texture)(object)(await BetterSonLaserPlugin.LoadAsset<Texture2D>("RoR2/Base/Common/ColorRamps/texRampBombOrb.png"))); sonTracer.SetFloat("_Boost", 5f); GameObject laserTracer = PrefabAPI.InstantiateClone(await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/DLC2/FalseSon/FalseSonPreLaser.prefab"), "FalseSonCustomLaserTracer", false); LineRenderer line = laserTracer.GetComponent<LineRenderer>(); line.startColor = Color32.op_Implicit(new Color32((byte)0, (byte)6, byte.MaxValue, byte.MaxValue)); line.endColor = new Color(0f, 255f, 203f, 255f); ((Renderer)line).materials = (Material[])(object)new Material[1] { sonTracer }; return laserTracer; } public IEnumerable<Type> GetEntityStates() { return new Type[2] { typeof(BetterLaserCharge), typeof(BetterLaserFire) }; } [CompilerGenerated] [DebuggerHidden] private Task <>n__0() { return ((Concentric)this).Initialize(); } } public class BetterLaserChargeEffect : Concentric, IGenericObject, IGameObject { async Task<GameObject> IGenericObject.BuildObject() { GameObject effect = PrefabAPI.InstantiateClone(await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/DLC2/FalseSonBoss/LunarGazePlusChargeEffect.prefab"), "BetterSonLaserChargeEffect", false); GameObject sparks = ((Component)effect.transform.GetChild(1)).gameObject; sparks.transform.localScale = Vector3.one * 0.5f; GameObject rocks = ((Component)sparks.transform.GetChild(2)).gameObject; ParticleSystem system = rocks.GetComponent<ParticleSystem>(); ShapeModule shapeModule = system.shape; ((ShapeModule)(ref shapeModule)).scale = Vector3.one * 0.6f; system.emissionRate = 25f; GameObject flare = ((Component)sparks.transform.GetChild(1)).gameObject; flare.transform.localScale = Vector3.one * 0.7f; return effect; } } public class BetterLaserFirePrefab : Concentric, IGenericObject, IGameObject { async Task<GameObject> IGenericObject.BuildObject() { Material fixedEyeGlow = new Material(await BetterSonLaserPlugin.LoadAsset<Material>("RoR2/DLC2/FalseSonBoss/matLunarGazePlusFireLaser4.mat")); fixedEyeGlow.SetFloat("_DstBlendFloat", 10f); fixedEyeGlow.SetFloat("_Boost", 1f); GameObject effect = PrefabAPI.InstantiateClone(await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/DLC2/FalseSonBoss/LunarGazePlusFireLaser.prefab"), "BetterSonLaserFirePrefab", false); GameObject eyeFlare = ((Component)effect.transform.Find("LaserTitan 3 (1)/Start/Flare/Flare (1)")).gameObject; eyeFlare.transform.localScale = Vector3.one * 0.5f; ParticleSystemRenderer eyeRenderer = eyeFlare.GetComponent<ParticleSystemRenderer>(); ((Renderer)eyeRenderer).material = fixedEyeGlow; GameObject lightshaftThing = ((Component)effect.transform.Find("LaserTitan 3 (1)/Start/Flare/Flare (3)")).gameObject; lightshaftThing.transform.localScale = Vector3.one * 0.6f; GameObject blueThing = ((Component)effect.transform.Find("LaserTitan 3 (1)/Start/Flare")).gameObject; blueThing.transform.localScale = Vector3.one * 0.5f; GameObject rocks = ((Component)effect.transform.Find("LaserTitan 3 (1)/Start/Flare/Physics")).gameObject; rocks.transform.localScale = new Vector3(1f, 1f, 3f); return effect; } } public class BetterLaserFireMuzzleFlash : Concentric, IEffect, IGameObject { async Task<GameObject> IEffect.BuildObject() { GameObject effect = PrefabAPI.InstantiateClone(await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/DLC2/FalseSonBoss/LunarGazeFireEffect.prefab"), "BetterSonLaserFireMuzzleFlash", false); GameObject sparks = ((Component)effect.transform.GetChild(0)).gameObject; sparks.transform.localScale = Vector3.one * 0.5f; return effect; } } public class WhyDoesGearboxUseLegacyResourcesAPI : Concentric, IEffect, IGameObject { async Task<GameObject> IEffect.BuildObject() { return PrefabAPI.InstantiateClone(await BetterSonLaserPlugin.LoadAsset<GameObject>("RoR2/DLC2/FalseSonBoss/LunarRainExplosionVFX.prefab"), "BetterSonLaserDoneChargingEffect", false); } } [BepInPlugin("com.Nines.BetterSonLaser", "BetterSonLaser", "1.0.0")] public class BetterSonLaserPlugin : BaseUnityPlugin { private class ContentPackProvider : IContentPackProvider { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CollectContentPackProvidersDelegate <>9__7_0; internal void <Initialize>b__7_0(AddContentPackProviderDelegate provider) { provider.Invoke((IContentPackProvider)(object)new ContentPackProvider()); } } private static Task<ContentPack> _contentPack; private static string _identifier; public string identifier => _identifier; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { while (!_contentPack.IsCompleted) { yield return null; } if (_contentPack.IsFaulted) { throw _contentPack.Exception; } ContentPack.Copy(_contentPack.Result, args.output); args.ReportProgress(1f); } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); log.LogInfo((object)"Contentpack finished"); yield break; } internal static void Initialize(string identifier, Task<ContentPack> pack) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _identifier = identifier; _contentPack = pack; object obj = <>c.<>9__7_0; if (obj == null) { CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate provider) { provider.Invoke((IContentPackProvider)(object)new ContentPackProvider()); }; <>c.<>9__7_0 = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; } } public const string AssetBundleName = "sondle"; public const string SoundBankName = ""; public static Dictionary<string, AssetBundle> bundles = new Dictionary<string, AssetBundle>(); public static string? pluginPath; public static BetterSonLaserPlugin instance = null; public static ManualLogSource log = null; public static bool soundBankQueued; public const string Guid = "com.Nines.BetterSonLaser"; public const string Name = "BetterSonLaser"; public const string Version = "1.0.0"; public void Awake() { instance = this; log = ((BaseUnityPlugin)this).Logger; log.LogDebug((object)"Getting Plugin Path"); pluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? throw new InvalidOperationException("Failed to find path of plugin."); Language.collectLanguageRootFolders += delegate(List<string> folders) { folders.Add(Path.Combine(pluginPath, "Language")); }; log.LogDebug((object)"Loading Concentric Bundle"); string path2 = Path.Join((ReadOnlySpan<char>)pluginPath, (ReadOnlySpan<char>)"Assets"); string[] bundlePaths = (from x in Directory.EnumerateFiles(path2) where !x.EndsWith("manifest") select x).ToArray(); string[] array = bundlePaths; foreach (string path in array) { ((AsyncOperation)AssetBundle.LoadFromFileAsync(path)).completed += delegate(AsyncOperation operation) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) string fileName = Path.GetFileName(path); log.LogDebug((object)(fileName + " Bundle Loaded")); bundles[fileName] = ((AssetBundleCreateRequest)operation).assetBundle; if (bundles.Count == bundlePaths.Length) { log.LogDebug((object)"Loading ContentPack"); ContentPackProvider.Initialize(((BaseUnityPlugin)this).Info.Metadata.GUID, Concentric.BuildContentPack(Assembly.GetExecutingAssembly())); } }; } log.LogDebug((object)"Finished Awake"); } public static Task<T> LoadAsset<T>(string assetPath) where T : Object { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) string text; int length; if (assetPath.StartsWith("addressable:")) { text = assetPath; length = "addressable:".Length; return Addressables.LoadAssetAsync<T>((object)text.Substring(length, text.Length - length)).Task; } if (assetPath.StartsWith("legacy:")) { text = assetPath; length = "legacy:".Length; return LegacyResourcesAPI.LoadAsync<T>(text.Substring(length, text.Length - length)).Task; } int num = assetPath.IndexOf(":", StringComparison.Ordinal); if (num <= 0) { return Addressables.LoadAssetAsync<T>((object)assetPath).Task; } TaskCompletionSource<T> source = new TaskCompletionSource<T>(); AssetBundle obj = bundles[assetPath.Substring(0, num)]; text = assetPath; length = num + 1; AssetBundleRequest handle = obj.LoadAssetAsync<T>(text.Substring(length, text.Length - length)); ((AsyncOperation)handle).completed += delegate { source.SetResult((T)(object)handle.asset); }; return source.Task; } [HarmonyPrefix] [HarmonyPatch(typeof(SoundbankLoader), "Start")] public static void AddSoundbankToLoader(SoundbankLoader __instance) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!soundBankQueued) { log.LogDebug((object)"Soundbank Added To Queue"); AkSoundEngine.AddBasePath(pluginPath); __instance.soundbankStrings = CollectionExtensions.AddItem<string>((IEnumerable<string>)__instance.soundbankStrings, "").ToArray(); soundBankQueued = true; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }