Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of BanditsPrimaryRevolver v1.0.3
MyFirstMod/BanditsPrimaryRevolver.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BanditsPrimaryRevolver.MyEntityStates; using BepInEx; using BepInEx.Logging; using EntityStates; using EntityStates.Bandit2.Weapon; using HG.Reflection; using R2API; using RoR2; using RoR2.Skills; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: InternalsVisibleTo("R2API.Items")] [assembly: InternalsVisibleTo("R2API.ContentManagement")] [assembly: InternalsVisibleTo("R2API.ArtifactCode")] [assembly: InternalsVisibleTo("R2API.Difficulty")] [assembly: InternalsVisibleTo("R2API.Elites")] [assembly: InternalsVisibleTo("R2API.RecalculateStats")] [assembly: InternalsVisibleTo("R2API.Prefab")] [assembly: InternalsVisibleTo("R2API.Language")] [assembly: InternalsVisibleTo("R2API.Unlockable")] [assembly: InternalsVisibleTo("R2API.TempVisualEffect")] [assembly: InternalsVisibleTo("R2API.SceneAsset")] [assembly: InternalsVisibleTo("R2API.Orb")] [assembly: InternalsVisibleTo("R2API.Loadout")] [assembly: InternalsVisibleTo("R2API.Dot")] [assembly: InternalsVisibleTo("R2API.DamageType")] [assembly: InternalsVisibleTo("R2API.Sound")] [assembly: InternalsVisibleTo("R2API.Director")] [assembly: InternalsVisibleTo("R2API.Deployable")] [assembly: InternalsVisibleTo("R2API.LobbyConfig")] [assembly: InternalsVisibleTo("R2API.Networking")] [assembly: InternalsVisibleTo("R2API.CommandHelper")] [assembly: InternalsVisibleTo("R2API.Colors")] [assembly: InternalsVisibleTo("R2API.Rules")] [assembly: InternalsVisibleTo("R2API.Skins")] [assembly: InternalsVisibleTo("R2API.StringSerializerExtensions")] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("BanditsPrimaryRevolver")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BanditsPrimaryRevolver")] [assembly: AssemblyTitle("BanditsPrimaryRevolver")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace ExamplePlugin { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace BanditsPrimaryRevolver { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Icarus", "Bandit's Primary Revolver", "1.0.0")] public class BanditsPrimaryRevolver : BaseUnityPlugin { public static class Assets { public static AssetBundle mainBundle; public const string bundleName = "asseticon"; public static string AssetBundlePath { get { string directoryName = Path.GetDirectoryName(PInfo.Location); return Path.Combine(directoryName, "asseticon"); } } public static void Init() { mainBundle = AssetBundle.LoadFromFile(AssetBundlePath); } } public static PluginInfo PInfo { get; private set; } public void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_0175: 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) PInfo = ((BaseUnityPlugin)this).Info; Assets.Init(); Sprite icon = Assets.mainBundle.LoadAsset<Sprite>("SkillIcon"); GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Body.prefab").WaitForCompletion(); LanguageAPI.Add("BANDIT2_PRIMARY_REVOLVER_NAME", "Revolver"); LanguageAPI.Add("BANDIT2_PRIMARY_REVOLVER_DESCRIPTION", "Fire a bullet from your Revolver for <style=cIsDamage>600% damage</style>."); SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>(); val2.activationState = new SerializableEntityStateType(typeof(Revolver)); val2.activationStateMachineName = "Weapon"; val2.baseMaxStock = 6; val2.baseRechargeInterval = 2.5f; val2.beginSkillCooldownOnSkillEnd = false; val2.canceledFromSprinting = false; val2.cancelSprintingOnActivation = true; val2.fullRestockOnAssign = true; val2.interruptPriority = (InterruptPriority)0; val2.isCombatSkill = true; val2.mustKeyPress = false; val2.rechargeStock = 6; val2.requiredStock = 1; val2.stockToConsume = 1; val2.resetCooldownTimerOnUse = true; val2.beginSkillCooldownOnSkillEnd = true; val2.icon = icon; val2.skillDescriptionToken = "BANDIT2_PRIMARY_REVOLVER_DESCRIPTION"; val2.skillName = "BANDIT2_PRIMARY_REVOLVER_NAME"; val2.skillNameToken = "BANDIT2_PRIMARY_REVOLVER_NAME"; ContentAddition.AddSkillDef(val2); SkillLocator component = val.GetComponent<SkillLocator>(); SkillFamily skillFamily = component.primary.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val3 = new Variant { skillDef = val2 }; ((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null); variants[num] = val3; } } } namespace BanditsPrimaryRevolver.MyEntityStates { public class Revolver : BaseSkillState { public float baseDuration = 0.5f; private float duration; public float revolverDuration; public GameObject crosshairOverridePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2CrosshairPrepRevolverFire.prefab").WaitForCompletion(); private Animator animator; private int bodySideWeaponLayerIndex; private OverrideRequest crosshairOverrideRequest; public GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/HitsparkBandit2Pistol.prefab").WaitForCompletion(); public GameObject tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/TracerBanditPistol.prefab").WaitForCompletion(); public GameObject effectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/MuzzleflashBandit2.prefab").WaitForCompletion(); public virtual string exitAnimationStateName => "BufferEmpty"; public override void OnEnter() { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_0195: 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_01ab: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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) ((BaseState)this).OnEnter(); ((EntityState)this).skillLocator.primary.finalRechargeInterval = ((EntityState)this).skillLocator.primary.baseRechargeInterval / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); if (Object.op_Implicit((Object)(object)animator)) { bodySideWeaponLayerIndex = animator.GetLayerIndex("Body, SideWeapon"); animator.SetLayerWeight(bodySideWeaponLayerIndex, 1f); } if (Object.op_Implicit((Object)(object)crosshairOverridePrefab)) { crosshairOverrideRequest = CrosshairUtils.RequestOverrideForBody(((EntityState)this).characterBody, crosshairOverridePrefab, (OverridePriority)1); } ((EntityState)this).characterBody.SetAimTimer(3f); duration = baseDuration / ((BaseState)this).attackSpeedStat; revolverDuration = duration; Ray aimRay = ((BaseState)this).GetAimRay(); ((BaseState)this).StartAimMode(aimRay, 2f, false); ((EntityState)this).PlayAnimation("Gesture, Additive", "FireSideWeapon", "FireSideWeapon.playbackRate", duration); Util.PlaySound("Play_bandit2_R_fire", ((EntityState)this).gameObject); ((BaseState)this).AddRecoil(-0.6f, 0.6f, -0.6f, 0.6f); if (Object.op_Implicit((Object)(object)effectPrefab)) { EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, "MuzzlePistol", false); } if (((EntityState)this).isAuthority) { new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = ((Ray)(ref aimRay)).origin, aimVector = ((Ray)(ref aimRay)).direction, minSpread = 0f, maxSpread = ((EntityState)this).characterBody.spreadBloomAngle, bulletCount = 1u, procCoefficient = 1f, damage = ((EntityState)this).characterBody.damage * 6f, force = 3f, falloffModel = (FalloffModel)1, tracerEffectPrefab = tracerEffectPrefab, muzzleName = "MuzzlePistol", hitEffectPrefab = hitEffectPrefab, isCrit = ((BaseState)this).RollCrit(), HitEffectNormal = false, stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask, smartCollision = true, maxDistance = 300f }.Fire(); } } public override void OnExit() { ((EntityState)this).OnExit(); if (Object.op_Implicit((Object)(object)animator)) { animator.SetLayerWeight(bodySideWeaponLayerIndex, 0f); } Transform val = ((BaseState)this).FindModelChild("SpinningPistolFX"); } public override void FixedUpdate() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextState((EntityState)new ExitSidearmRevolver()); } } 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; } } }