Bonelab mods are targeting MelonLoader version 0.5.7. Newer versions will not work!, so double-check your MelonLoader version if you're having issues.
Decompiled source of FantasyColiseum v2.0.0
Mods/FantasyColiseum.dll
Decompiled 7 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using BoneLib.BoneMenu.Elements; using FantasyColiseum; using FantasyColiseum.Melon; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using SLZ.Bonelab; using SLZ.Marrow.SceneStreaming; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Unlocks the max enemy count in Fantasy Arena.")] [assembly: AssemblyDescription("Unlocks the max enemy count in Fantasy Arena.")] [assembly: AssemblyCompany("Weather Electric")] [assembly: AssemblyProduct("Fantasy Coliseum")] [assembly: AssemblyCopyright("Developed by SoulWithMae")] [assembly: AssemblyTrademark("Weather Electric")] [assembly: AssemblyFileVersion("2.0.0")] [assembly: MelonInfo(typeof(Main), "Fantasy Coliseum", "2.0.0", "SoulWithMae", "https://bonelab.thunderstore.io/package/SoulWithMae/FantasyColiseum/")] [assembly: MelonColor(ConsoleColor.Yellow)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("2.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FantasyColiseum { public class Main : MelonMod { internal const string Name = "Fantasy Coliseum"; internal const string Description = "Unlocks the max enemy count in Fantasy Arena."; internal const string Author = "SoulWithMae"; internal const string Company = "Weather Electric"; internal const string Version = "2.0.0"; internal const string DownloadLink = "https://bonelab.thunderstore.io/package/SoulWithMae/FantasyColiseum/"; public static string LevelBarcode; public override void OnInitializeMelon() { ModConsole.Setup(((MelonBase)this).LoggerInstance); Preferences.Setup(); BoneMenu.Setup(); Hooking.OnLevelInitialized += OnLevelLoad; } private static void OnLevelLoad(LevelInfo levelInfo) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) LevelBarcode = levelInfo.barcode; } } [HarmonyPatch(typeof(ArenaMenuController), "Start")] public static class ArenaPatch { [HarmonyPostfix] public static void Postfix(ArenaMenuController __instance) { if (!(Main.LevelBarcode != "fa534c5a868247138f50c62e424c4144.Level.LevelArenaMin") && Preferences.Enabled.Value) { ModConsole.Msg("Setting max enemy count to 500", 1); __instance.maxEnemyCount = 500; ModConsole.Msg("Setting max concurrent to 500", 1); __instance.maxConcurrent = 500; ModConsole.Msg("Setting max friendly count to 500", 1); __instance.maxFriendlyCount = 500; } } } } namespace FantasyColiseum.Melon { internal static class BoneMenu { private static readonly MelonEvent<bool, bool> OnEntryValueChanged = Preferences.Enabled.OnEntryValueChanged; private static MenuCategory _menuCategory; private static FunctionElement _reloadButton; public static void Setup() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) _menuCategory = MenuManager.CreateCategory("Weather Electric", "#6FBDFF").CreateCategory("Fantasy Coliseum", "#fec500"); _menuCategory.CreateBoolPreference("Mod Enabled", Color.white, Preferences.Enabled, Preferences.OwnCategory); ((MelonEventBase<LemonAction<bool, bool>>)(object)OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)AddReloadButton, 0, false); } private static void AddReloadButton(bool oldval, bool newval) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!(Main.LevelBarcode != "fa534c5a868247138f50c62e424c4144.Level.LevelArenaMin") && _reloadButton == null) { _reloadButton = _menuCategory.CreateFunctionElement("Reload Level", Color.red, (Action)delegate { SceneStreamer.Reload(); _menuCategory.Elements.Remove((MenuElement)(object)_reloadButton); _reloadButton = null; }); } } } internal static class BoneMenuExtensions { public static BoolElement CreateBoolPreference(this MenuCategory category, string name, Color color, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) return category.CreateBoolElement(name, color, pref.Value, (Action<bool>)delegate(bool v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static BoolElement CreateBoolPreference(this MenuCategory category, string name, string hexColor, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { return category.CreateBoolElement(name, hexColor, pref.Value, (Action<bool>)delegate(bool v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static BoolElement CreateBoolPreference(this SubPanelElement category, string name, Color color, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) return category.CreateBoolElement(name, color, pref.Value, (Action<bool>)delegate(bool v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static BoolElement CreateBoolPreference(this SubPanelElement category, string name, string hexColor, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { return category.CreateBoolElement(name, hexColor, pref.Value, (Action<bool>)delegate(bool v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static FloatElement CreateFloatPreference(this MenuCategory category, string name, Color color, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) return category.CreateFloatElement(name, color, pref.Value, increment, min, max, (Action<float>)delegate(float v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static FloatElement CreateFloatPreference(this MenuCategory category, string name, string hexColor, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { return category.CreateFloatElement(name, hexColor, pref.Value, increment, min, max, (Action<float>)delegate(float v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static FloatElement CreateFloatPreference(this SubPanelElement category, string name, Color color, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) return category.CreateFloatElement(name, color, pref.Value, increment, min, max, (Action<float>)delegate(float v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static FloatElement CreateFloatPreference(this SubPanelElement category, string name, string hexColor, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { return category.CreateFloatElement(name, hexColor, pref.Value, increment, min, max, (Action<float>)delegate(float v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static IntElement CreateIntPreference(this MenuCategory category, string name, Color color, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) return category.CreateIntElement(name, color, pref.Value, increment, min, max, (Action<int>)delegate(int v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static IntElement CreateIntPreference(this MenuCategory category, string name, string hexColor, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { return category.CreateIntElement(name, hexColor, pref.Value, increment, min, max, (Action<int>)delegate(int v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static IntElement CreateIntPreference(this SubPanelElement category, string name, Color color, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) return category.CreateIntElement(name, color, pref.Value, increment, min, max, (Action<int>)delegate(int v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static IntElement CreateIntPreference(this SubPanelElement category, string name, string hexColor, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true) { return category.CreateIntElement(name, hexColor, pref.Value, increment, min, max, (Action<int>)delegate(int v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this MenuCategory category, string name, Color color, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum { //IL_001f: Unknown result type (might be due to invalid IL or missing references) return category.CreateEnumElement<TEnum>(name, color, pref.Value, (Action<TEnum>)delegate(TEnum v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this MenuCategory category, string name, string hexColor, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum { return category.CreateEnumElement<TEnum>(name, hexColor, pref.Value, (Action<TEnum>)delegate(TEnum v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this SubPanelElement category, string name, Color color, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum { //IL_001f: Unknown result type (might be due to invalid IL or missing references) return category.CreateEnumElement<TEnum>(name, color, pref.Value, (Action<TEnum>)delegate(TEnum v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } public static EnumElement<TEnum> CreateEnumPreference<TEnum>(this SubPanelElement category, string name, string hexColor, MelonPreferences_Entry<TEnum> pref, MelonPreferences_Category prefCategory, bool autoSave = true) where TEnum : Enum { return category.CreateEnumElement<TEnum>(name, hexColor, pref.Value, (Action<TEnum>)delegate(TEnum v) { pref.Value = v; if (autoSave) { prefCategory.SaveToFile(false); } }); } } internal static class ModConsole { private static Instance _logger; public static void Setup(Instance loggerInstance) { _logger = loggerInstance; } public static void Msg(object obj, int loggingMode = 0) { string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString()); ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Msg(consoleColor, text); } } public static void Msg(string txt, int loggingMode = 0) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Msg(consoleColor, text); } } public static void Msg(ConsoleColor txtcolor, object obj, int loggingMode = 0) { string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString()); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Msg(txtcolor, text); } } public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Msg(txtcolor, text); } } public static void Msg(string txt, int loggingMode = 0, params object[] args) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Msg(consoleColor, text, args); } } public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0, params object[] args) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Msg(txtcolor, text, args); } } public static void Error(object obj, int loggingMode = 0) { string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString()); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Error(text); } } public static void Error(string txt, int loggingMode = 0) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Error(text); } } public static void Error(string txt, int loggingMode = 0, params object[] args) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Error(text, args); } } public static void Warning(object obj, int loggingMode = 0) { string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString()); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Warning(text); } } public static void Warning(string txt, int loggingMode = 0) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Warning(text); } } public static void Warning(string txt, int loggingMode = 0, params object[] args) { string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt); if (Preferences.LoggingMode.Value >= loggingMode) { _logger.Warning(text, args); } } } internal static class Preferences { private static readonly MelonPreferences_Category GlobalCategory = MelonPreferences.CreateCategory("Global"); public static readonly MelonPreferences_Category OwnCategory = MelonPreferences.CreateCategory("Fantasy Coliseum"); public static MelonPreferences_Entry<int> LoggingMode { get; private set; } public static MelonPreferences_Entry<bool> Enabled { get; private set; } public static void Setup() { LoggingMode = GlobalCategory.GetEntry<int>("LoggingMode") ?? GlobalCategory.CreateEntry<int>("LoggingMode", 0, "Logging Mode", "The level of logging to use. 0 = Important Only, 1 = All", false, false, (ValueValidator)null, (string)null); Enabled = OwnCategory.GetEntry<bool>("Enabled") ?? OwnCategory.CreateEntry<bool>("Enabled", true, "Enabled", "If the mod should unlock the max enemy count or not.", false, false, (ValueValidator)null, (string)null); GlobalCategory.SetFilePath(MelonUtils.UserDataDirectory + "/WeatherElectric.cfg"); GlobalCategory.SaveToFile(false); OwnCategory.SetFilePath(MelonUtils.UserDataDirectory + "/WeatherElectric.cfg"); OwnCategory.SaveToFile(false); ModConsole.Msg("Finished preferences setup for Fantasy Coliseum", 1); } } }