Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of LTGCapacitor v2.0.0
LTGCapacitor.dll
Decompiled 21 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2.Orbs; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Options; using RoR2.Orbs; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LTGCapacitor")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LTGCapacitor")] [assembly: AssemblyTitle("LTGCapacitor")] [assembly: AssemblyVersion("1.0.0.0")] namespace LTGCapacitor; [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Arbition.LTGCapacitor", "LTGCapacitor", "2.0.0")] public class LTGCapacitor : BaseUnityPlugin { public static AssetBundle LTGBundle; public static ConfigEntry<float> LTGVolume { get; set; } public void Awake() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ModLogger modLogger = new ModLogger("LTGCapacitor"); NetworkingAPI.RegisterMessageType<SyncSound>(); Assets.LoadSoundBank("LTGCapacitor.LTG_KYS.bnk"); Assets.LoadBundle("LTGCapacitor.ltgcapacitor"); Sprite val = Assets.LoadSprite("LTG"); if ((Object)(object)val != (Object)null) { modLogger.Log("Icon loaded successfully"); } else { modLogger.LogError("Failed to load icon"); } LTGVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 100f, "How loud it should be (between 0-100). Keep in mind that the audio for this mod is already affected by the SFX volume setting (and master volume as well by extension), so this is just if you want to adjust it further from there."); ModSettingsManager.AddOption((BaseOption)new SliderOption(LTGVolume)); ModSettingsManager.SetModDescription("Soundmod that plays the LTG \"NOW\" sound effect whenever you smite something. Now with adjustable volume!"); ModSettingsManager.SetModIcon(val); LightningStrikeOrb.GetOrbEffect += new hook_GetOrbEffect(LightningStrikeOrb_GetOrbEffect); modLogger.Log("Mod loaded successfully"); } private GameObject LightningStrikeOrb_GetOrbEffect(orig_GetOrbEffect orig, LightningStrikeOrb self) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) GameObject result = orig.Invoke(self); Vector3 position = ((Component)((Orb)self).target).transform.position; PlayLTGSound(position); NetMessageExtensions.Send((INetMessage)(object)new SyncSound(position), (NetworkDestination)1); return result; } public static void PlayLTGSound(Vector3 position) { //IL_0015: 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_002b: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) AkSoundEngine.SetRTPCValue("LTG_Volume", LTGVolume.Value); GameObject emitter = new GameObject("LTGSfxEmitter"); emitter.transform.position = position; SimpleTimer simpleTimer = emitter.AddComponent<SimpleTimer>(); simpleTimer.time = 0.5f; simpleTimer.OnTimerEnd = delegate { uint num = AkSoundEngine.PostEvent(2876086281u, emitter); }; Object.Destroy((Object)(object)emitter, 3f); } } public class SyncSound : INetMessage, ISerializableObject { private Vector3 soundPosition; public SyncSound() { } public SyncSound(Vector3 soundPosition) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.soundPosition = soundPosition; } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) soundPosition = reader.ReadVector3(); } public void OnReceived() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ModLogger.LogStatic("SyncSound: Host ran this. Skip."); } else { LTGCapacitor.PlayLTGSound(soundPosition); } } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(soundPosition); } } public class SimpleTimer : MonoBehaviour { public float time; public Action OnTimerEnd = delegate { }; private void Update() { time -= Time.deltaTime; if (time <= 0f) { OnTimerEnd?.Invoke(); Object.Destroy((Object)(object)this); } } } public static class Assets { public static AssetBundle Bundle; public static bool LoadBundle(string bndl) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(bndl); if (stream == null) { ModLogger.LogErrorStatic("Embedded AssetBundle not found!"); return false; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Bundle = AssetBundle.LoadFromMemory(array); if ((Object)(object)Bundle != (Object)null) { ModLogger.LogStatic("AssetBundle loaded from embedded resource!"); return true; } ModLogger.LogErrorStatic("Failed to load AssetBundle from memory!"); return false; } public static bool LoadSoundBank(string bnk) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(bnk); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); SoundBanks.Add(array); ModLogger.LogStatic("Soundbank loaded successfully"); return true; } ModLogger.LogErrorStatic("Soundbank failed to load"); return false; } public static Sprite LoadSprite(string name) { if ((Object)(object)Bundle == (Object)null) { return null; } return Bundle.LoadAsset<Sprite>("Assets/Icons/" + name + ".png"); } } public class ModLogger { private readonly string modID; public static ModLogger Default; public ModLogger(string modID, bool setAsDefault = true) { this.modID = modID; if (setAsDefault) { Default = this; } } public void Log(string message) { Debug.Log((object)("[" + modID + "] " + message)); } public void LogError(string message) { Debug.LogError((object)("[" + modID + "] " + message)); } public static void LogStatic(string message) { Default?.Log(message); } public static void LogErrorStatic(string message) { Default?.LogError(message); } }