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 AutoShot v1.2.3
AutoShot.dll
Decompiled a year agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using EntityStates.Commando.CommandoWeapon; using R2API; using R2API.Utils; using RoR2; using RoR2.Skills; using TILER2; using ThinkInvisible.ClassicItems; using UnityEngine; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AutoShot")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3d3dd6ee2027d811563caaf12221670ea0dcdf12")] [assembly: AssemblyProduct("AutoShot")] [assembly: AssemblyTitle("AutoShot")] [assembly: AssemblyVersion("1.0.0.0")] namespace AutoShot { public class AutoShot : BaseState { public float BaseDuration = 1.3f; public float Duration; public float FireTimer; public float TimeBetweenBullets; public float FiringDuration; public static GameObject hitEffectPrefab = Resources.Load<GameObject>("prefabs/effects/impacteffects/critspark"); public static GameObject tracerEffectPrefab = Resources.Load<GameObject>("prefabs/effects/tracers/tracerbanditshotgun"); private List<HurtBox> _targetHurtboxes = new List<HurtBox>(); public int TotalBulletsToFire; public int TotalBulletsFired; private int _targetHurtboxIndex; private bool _hasSuccessfullyFoundTarget; public virtual float FieldOfView => 100f; public virtual float MaxDistance => 150f; public virtual DamageType DamageType => (DamageType)32; public virtual int MinimumFireCount => AutoShotPlugin.MinimumFireCount.Value; public virtual float Damage => AutoShotPlugin.DamageCoefficient.Value; public virtual float RecoilAmplitude => 2f; public override void OnEnter() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Duration = BaseDuration / base.attackSpeedStat; FiringDuration = BaseDuration / base.attackSpeedStat; Ray aimRay = ((BaseState)this).GetAimRay(); ((EntityState)this).characterBody.SetAimTimer(3f); ((EntityState)this).PlayAnimation("Gesture, Additive", "FireSweepBarrage", "FireSweepBarrage.playbackRate", BaseDuration * 1.1f, 0f); ((EntityState)this).PlayAnimation("Gesture, Override", "FireSweepBarrage", "FireSweepBarrage.playbackRate", BaseDuration * 1.1f, 0f); BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(((BaseState)this).GetTeam()), filterByLoS = true, searchOrigin = ((Ray)(ref aimRay)).origin, searchDirection = ((Ray)(ref aimRay)).direction, sortMode = (SortMode)3, maxDistanceFilter = MaxDistance, maxAngleFilter = FieldOfView * 0.5f }; val.RefreshCandidates(); _targetHurtboxes = val.GetResults().Where((Func<HurtBox, bool>)Util.IsValid).Distinct((IEqualityComparer<HurtBox>?)(object)default(EntityEqualityComparer)) .ToList(); TotalBulletsToFire = Mathf.Max(_targetHurtboxes.Count, MinimumFireCount); TimeBetweenBullets = FiringDuration / (float)TotalBulletsToFire; } private void Fire() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0273: Unknown result type (might be due to invalid IL or missing references) if (isListEmpty(_targetHurtboxes) || TotalBulletsFired >= TotalBulletsToFire) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); PlayerCharacterMasterController cachedMasterController = firstLocalUser.cachedMasterController; if (!Object.op_Implicit((Object)(object)cachedMasterController)) { return; } CharacterBody body = cachedMasterController.master.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } InputBankTest component = ((Component)body).GetComponent<InputBankTest>(); Ray val = default(Ray); ((Ray)(ref val))..ctor(component.aimOrigin, component.aimDirection); ((BaseState)this).AddRecoil(-0.8f * RecoilAmplitude, -1f * RecoilAmplitude, -0.1f * RecoilAmplitude, 0.15f * RecoilAmplitude); if (_targetHurtboxIndex >= _targetHurtboxes.Count) { _targetHurtboxIndex = 0; } HurtBox val2 = _targetHurtboxes[_targetHurtboxIndex]; if (_targetHurtboxes.Count > 0 && Object.op_Implicit((Object)(object)val2)) { _hasSuccessfullyFoundTarget = true; _targetHurtboxIndex++; Vector3 val3 = ((Component)val2).transform.position - ((Ray)(ref val)).origin; ((EntityState)this).inputBank.aimDirection = val3; HealthComponent healthComponent = val2.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent) && ((EntityState)this).isAuthority) { new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = ((Ray)(ref val)).origin, muzzleName = "MuzzleRight", aimVector = val3, minSpread = 0f, maxSpread = ((EntityState)this).characterBody.spreadBloomAngle, bulletCount = 1u, procCoefficient = AutoShotPlugin.ProcCoefficient.Value, damage = ((EntityState)this).characterBody.damage * Damage, force = 3f, falloffModel = (FalloffModel)1, tracerEffectPrefab = tracerEffectPrefab, hitEffectPrefab = hitEffectPrefab, isCrit = ((BaseState)this).RollCrit(), HitEffectNormal = false, damageType = DamageTypeCombo.op_Implicit(DamageType), stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask, smartCollision = true, maxDistance = MaxDistance }.Fire(); } Util.PlaySound(FireBarrage.fireBarrageSoundString, ((EntityState)this).gameObject); ((EntityState)this).characterBody.AddSpreadBloom(FireBarrage.spreadBloomValue); } TotalBulletsFired++; } public override void OnExit() { ((EntityState)this).OnExit(); if (!_hasSuccessfullyFoundTarget && NetworkServer.active) { ((EntityState)this).skillLocator.special.AddOneStock(); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); FireTimer -= Time.fixedDeltaTime; if (FireTimer <= 0f) { Fire(); FireTimer += TimeBetweenBullets; } if (((EntityState)this).fixedAge >= Duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public bool isListEmpty(List<HurtBox> list) { return !list.Any(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)7; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [R2APISubmoduleDependency(new string[] { "ContentAddition" })] [BepInPlugin("com.lodington.AutoShot", "AutoShot", "1.2.0")] public sealed class AutoShotPlugin : BaseUnityPlugin { public const string MODNAME = "AutoShot"; public const string AUTHOR = "lodington"; public const string GUID = "com.lodington.AutoShot"; public const string VERSION = "1.2.0"; private SkillDef _autoShot; private SkillDef _autoShotScepter; private static GameObject _commandoBody = Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"); private SkillLocator skillLocator = _commandoBody.GetComponent<SkillLocator>(); public static AssetBundle _assets; public static ConfigEntry<float> DamageCoefficient { get; set; } public static ConfigEntry<int> MinimumFireCount { get; set; } public static ConfigEntry<float> ProcCoefficient { get; set; } public static ConfigEntry<float> StunEnabled { get; set; } private void Awake() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); _assets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "commandoskills")); DamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Damage Coefficient", "Damage Coefficient", 0.9f, "This Will set Damage Coefficient of Sweeping Barrage Skill Default Value is 0.9f"); MinimumFireCount = ((BaseUnityPlugin)this).Config.Bind<int>("minimum Fire Count", "minimum Fire Count", 10, "The minimum amount of times Sweeping barrage will shoot at targets less than X amount of enemys in range."); ProcCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Proc CoEfficient", "Proc CoEfficient", 1f, "This Will set proc Coefficient of Sweeping Barrage Skill Default Value is 1.0f"); SetupAutoShot(); if (Chainloader.PluginInfos.ContainsKey("com.ThinkInvisible.ClassicItems")) { ScepterSkillSetup(); ScepterSetup(); } } private void SetupAutoShot() { //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_00c9: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) _autoShot = ScriptableObject.CreateInstance<SkillDef>(); _autoShot.activationState = new SerializableEntityStateType(typeof(AutoShot)); _autoShot.skillNameToken = "Auto Shot"; _autoShot.skillName = "C_AUTO_SHOT"; _autoShot.skillDescriptionToken = "Fires a minimum of " + MinimumFireCount.Value + " <style=cIsUtility>auto-targeting</style> shots. Fire more shots depending on how many enemies are in your sights."; _autoShot.activationStateMachineName = "Weapon"; _autoShot.baseMaxStock = 1; _autoShot.baseRechargeInterval = 12f; _autoShot.beginSkillCooldownOnSkillEnd = false; _autoShot.canceledFromSprinting = false; _autoShot.fullRestockOnAssign = true; _autoShot.interruptPriority = (InterruptPriority)1; _autoShot.isCombatSkill = true; _autoShot.mustKeyPress = false; _autoShot.rechargeStock = 1; _autoShot.requiredStock = 1; _autoShot.cancelSprintingOnActivation = true; _autoShot.stockToConsume = 1; _autoShot.icon = _assets.LoadAsset<Sprite>("SWEEPING_BARRAGE"); ContentAddition.AddSkillDef(_autoShot); SkillFamily skillFamily = skillLocator.special.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = _autoShot, unlockableDef = ScriptableObject.CreateInstance<UnlockableDef>() }; ((Variant)(ref val)).viewableNode = new Node(_autoShot.skillNameToken, false, (Node)null); variants[num] = val; } private void ScepterSkillSetup() { //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_00ad: Unknown result type (might be due to invalid IL or missing references) _autoShotScepter = ScriptableObject.CreateInstance<SkillDef>(); _autoShotScepter.activationState = new SerializableEntityStateType(typeof(BulletHell)); _autoShotScepter.skillNameToken = "Bullet Hell"; _autoShotScepter.skillName = "C_AUTO_SHOT_SCEPTER"; _autoShotScepter.skillDescriptionToken = "Fires a minimum of 25 <style=cIsUtility>auto-targeting</style> shots. Fires at everything on your screen."; _autoShotScepter.activationStateMachineName = "Weapon"; _autoShotScepter.baseMaxStock = 1; _autoShotScepter.baseRechargeInterval = 6f; _autoShotScepter.beginSkillCooldownOnSkillEnd = false; _autoShotScepter.canceledFromSprinting = false; _autoShotScepter.fullRestockOnAssign = true; _autoShotScepter.interruptPriority = (InterruptPriority)1; _autoShotScepter.isCombatSkill = true; _autoShotScepter.mustKeyPress = false; _autoShot.cancelSprintingOnActivation = false; _autoShotScepter.rechargeStock = 1; _autoShotScepter.requiredStock = 1; _autoShotScepter.stockToConsume = 1; _autoShotScepter.icon = _assets.LoadAsset<Sprite>("SWEEPING_BARRAGE_SCEPTER"); ContentAddition.AddSkillDef(_autoShotScepter); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void ScepterSetup() { Item<Scepter>.instance.RegisterScepterSkill(_autoShotScepter, "CommandoBody", (SkillSlot)3, _autoShot); } } internal class BulletHell : AutoShot { public override float FieldOfView => float.MaxValue; public override float MaxDistance => float.MaxValue; public override DamageType DamageType => (DamageType)160; public override int MinimumFireCount => 25; public override float Damage => 1.3f; } } namespace AutoShot.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("AutoShot.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] commandoskills { get { object @object = ResourceManager.GetObject("commandoskills", resourceCulture); return (byte[])@object; } } internal Resources() { } } }