Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Curb Your Death v2.2.0
CurbYourDeath.dll
Decompiled 2 days agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using On.RoR2; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using UnityEngine; [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("CurbYourDeath")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CurbYourDeath")] [assembly: AssemblyTitle("CurbYourDeath")] [assembly: AssemblyVersion("1.0.0.0")] namespace CurbYourDeath; [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Arbition.CurbYourDeath", "Curb Your Death", "2.2.0")] public class CurbYourDeath : BaseUnityPlugin { private uint eventId; private bool curbPlaying = false; public static AssetBundle CYDBundle; public static ConfigEntry<float> CYDVolume { get; set; } public void Awake() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown Logger logger = new Logger("CurbYourDeath"); Assets.LoadSoundBank("CurbYourDeath.CYE.bnk"); Assets.LoadBundle("CurbYourDeath.curbyourdeath"); Sprite val = Assets.LoadSprite("CYD"); if ((Object)(object)val != (Object)null) { logger.Log("Icon loaded successfully"); } else { logger.LogError("Failed to load icon"); } CYDVolume = ((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 music 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(CYDVolume)); ModSettingsManager.SetModDescription("Soundmod that plays frolic from curb your enthusiasm when you lose the run."); ModSettingsManager.SetModIcon(val); Run.OnDestroy += (hook_OnDestroy)delegate(orig_OnDestroy orig, Run self) { AkSoundEngine.StopPlayingID(eventId, 2000); curbPlaying = false; orig.Invoke(self); }; Run.OnClientGameOver += (hook_OnClientGameOver)delegate(orig_OnClientGameOver orig, Run self, RunReport runReport) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!runReport.gameEnding.isWin) { AkSoundEngine.SetRTPCValue("CYE_Volume", CYDVolume.Value, ((Component)this).gameObject); eventId = AkSoundEngine.PostEvent(2106046636u, ((Component)this).gameObject); curbPlaying = true; orig.Invoke(self, runReport); } }; logger.Log("Mod loaded successfully"); } public void Update() { if (curbPlaying && Input.GetKeyDown((KeyCode)27)) { ((ConfigEntryBase)CYDVolume).ConfigFile.Reload(); AkSoundEngine.StopPlayingID(eventId, 5); curbPlaying = false; } } } public static class Assets { public static AssetBundle Bundle; public static bool LoadBundle(string bndl) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(bndl); if (stream == null) { Logger.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) { Logger.LogStatic("AssetBundle loaded from embedded resource!"); return true; } Logger.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); Logger.LogStatic("Soundbank loaded successfully"); return true; } Logger.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 Logger { private readonly string modID; public static Logger Default; public Logger(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); } }