Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ArtificerPrimaryVfx v1.0.0
ArtificerPrimaryVfx.dll
Decompiled 7 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Skills; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArtificerPrimaryVfx")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ArtificerPrimaryVfx")] [assembly: AssemblyTitle("ArtificerPrimaryVfx")] [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 ArtificerPrimaryVfx { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Moffein.ArtificerPrimaryVfx", "ArtificerPrimaryVfx", "1.0.0")] public class ArtificerPrimaryVfxPlugin : BaseUnityPlugin { public static class Vfx { public static GameObject Fire = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MuzzleflashMageFire.prefab").WaitForCompletion(); public static GameObject Lightning = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MuzzleflashMageLightning.prefab").WaitForCompletion(); public static GameObject Ice = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/Mage/MuzzleflashMageIce.prefab").WaitForCompletion(); } public static Dictionary<SkillDef, GameObject> SkillMappings = new Dictionary<SkillDef, GameObject>(); public static ConfigEntry<bool> enableSFX; private void Awake() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) ReadConfig(); RegisterVanillaSkills(); Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion().AddComponent<PrimaryReloadVFXComponent>(); } private void RegisterVanillaSkills() { //IL_000b: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) SkillMappings.Add(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFireFirebolt.asset").WaitForCompletion(), Vfx.Fire); SkillMappings.Add(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFireLightningBolt.asset").WaitForCompletion(), Vfx.Lightning); } private void ReadConfig() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown enableSFX = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Settings", "Play Sound"), true, new ConfigDescription("Play a sound whenever a new stock is gained.", (AcceptableValueBase)null, Array.Empty<object>())); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsCompat(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void RiskOfOptionsCompat() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableSFX)); } } public class PrimaryReloadVFXComponent : MonoBehaviour { private SkillLocator skillLocator; private int prevStock = 4; public bool rightGauntlet = true; private void Awake() { skillLocator = ((Component)this).GetComponent<SkillLocator>(); } private void FixedUpdate() { if (!((NetworkBehaviour)skillLocator).hasAuthority || !ArtificerPrimaryVfxPlugin.SkillMappings.TryGetValue(skillLocator.primary.skillDef, out GameObject value)) { return; } int stock = skillLocator.primary.stock; if (stock > prevStock) { EffectManager.SimpleMuzzleFlash(value, ((Component)this).gameObject, rightGauntlet ? "MuzzleRight" : "MuzzleLeft", true); rightGauntlet = !rightGauntlet; if (ArtificerPrimaryVfxPlugin.enableSFX.Value) { Util.PlaySound("Play_railgunner_m2_reload_basic", ((Component)this).gameObject); } } prevStock = stock; } } } namespace R2API.Utils { [AttributeUsage(AttributeTargets.Assembly)] public class ManualNetworkRegistrationAttribute : Attribute { } }