### ModHelper InstalledVersion Property Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Retrieves the currently installed version of Mod Helper. This static property returns a string representing the version. ```csharp public static string InstalledVersion { get; } ``` -------------------------------- ### ModHelper Fields Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Exposes static fields related to the compiled and installed versions of Mod Helper. ```APIDOC ## ModHelper.CompiledVersion Field The version of Mod Helper that this mod was compiled with ```csharp public const string CompiledVersion = "3.5.5"; ``` **Field Value:** System.String ``` -------------------------------- ### Handle Start Menu Entry Click - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI StartMenuEntryClicked is an override method that defines the action to be performed when the corresponding entry in the start menu is clicked. This method is not invoked if the entry has child entries. ```csharp public override void StartMenuEntryClicked(); ``` -------------------------------- ### Get Beginner Button - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the 'Beginner' difficulty button from the Map Select UI if the user is currently on the map selection screen. Returns a UnityEngine.UI.Toggle object representing the button, or null if not found. ```csharp public static Toggle GetBeginnerButton(); ``` -------------------------------- ### Get Dock Name for ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Defines the name displayed for this `ModWindow` within the game's dock. As the dock space is limited, shorter names are recommended. If `null`, no text is displayed. ```csharp public virtual string DockName { get; } ``` -------------------------------- ### Get All Opened ModWindow Instances (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Retrieves a read-only list of all `ModWindow` instances that have been opened for this type, including those that may be minimized. This property provides access to all window states. ```csharp public System.Collections.Generic.IReadOnlyList OpenedWindows { get; } ``` -------------------------------- ### ModHelper ModHelperDirectory Property Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Gets the directory path where Mod Helper stores its auxiliary information. This static property returns a string. ```csharp public static string ModHelperDirectory { get; } ``` -------------------------------- ### ModWindow Class Overview Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI The ModWindow class defines a type of window that can be opened in-game from the custom Mod Helper start menu. It allows for specific names and content, inheriting from ModStartMenuEntry. ```APIDOC ## ModWindow Class Defines a kind of Window that can be opened in game from the custom Mod Helper start menu with specific name and content. ```csharp public abstract class ModWindow : BTD_Mod_Helper.Api.UI.ModStartMenuEntry ``` **Inheritance:** System.Object ➔ ModContent ➔ NamedModContent ➔ ModStartMenuEntry ➔ ModWindow ``` -------------------------------- ### Get Window Info for ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Provides the `Mod Helper Info` object used to initially define the `ModHelperWindow`. This property holds essential metadata for the window's creation and identification. ```csharp public virtual BTD_Mod_Helper.Api.Components.Info WindowInfo { get; } ``` -------------------------------- ### Schedule Task Immediately as Coroutine Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api Schedules a task to execute immediately as a Coroutine. This is useful for running asynchronous operations that should start without delay. ```csharp public static void ScheduleTask(System.Collections.IEnumerator iEnumerator); // Parameters: // iEnumerator: The IEnumerator representing the coroutine to execute. ``` -------------------------------- ### Get Latest Mod Settings - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.Menus Provides a static property to access the most recent Melon instance for which settings are currently open. This allows for interaction with the specific mod's settings UI. ```csharp public static MelonBase Melon { get; set; } ``` -------------------------------- ### Get Minimum Height for Resizing ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Specifies the minimum height a `ModWindow` can be resized to. This property enforces a lower boundary for the window's height during user-initiated resizing. ```csharp public virtual int MinimumHeight { get; } ``` -------------------------------- ### Get Minimum Width for Resizing ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Specifies the minimum width a `ModWindow` can be resized to. This property sets a lower boundary for the window's width when the user attempts to resize it. ```csharp public virtual int MinimumWidth { get; } ``` -------------------------------- ### Get Final AudioClip and MusicItem Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Audio Represents the final AudioClip used for the Jukebox track and the BTD6 MusicItem created for it. The MusicItem can be set programmatically. ```csharp public virtual AudioClip AudioClip { get; } ``` ```csharp public MusicItem MusicItem { get; set; } ``` -------------------------------- ### ModHelper HasMod(string) Method Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Checks if a mod with the specified name is currently installed. This static method returns a boolean value. ```csharp public static bool HasMod(string name); ``` -------------------------------- ### ModHelper HasMod(string, out BloonsMod) Method Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Checks if a mod with the specified name is installed and, if so, assigns its instance to the out parameter 'bloonsMod'. Returns a boolean indicating presence. ```csharp public static bool HasMod(string name, out BTD_Mod_Helper.BloonsMod bloonsMod); ``` -------------------------------- ### Check if ModWindow is Hidden (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Overrides the base method to determine if this `ModWindow` start menu entry should be hidden from the menu. Returns `true` if hidden, `false` otherwise. ```csharp public override bool IsHidden(); ``` -------------------------------- ### Set Base Game Mode in C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Scenarios This snippet shows how to specify the base game mode to be used for a custom game mode. By setting the BaseGameMode property, developers can leverage existing game modes as a foundation, or start with an empty base if none is specified. ```csharp public abstract string BaseGameMode { get; } ``` -------------------------------- ### Get Default Width of ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Returns the default width of the `ModWindow` when it is initially created or displayed. Developers can use this property to define the standard width for their custom windows. ```csharp public virtual int DefaultWidth { get; } ``` -------------------------------- ### Get Active ModWindow Instances (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Retrieves a read-only list of all currently active and non-minimized window instances of a specific `ModWindow` type. This property is useful for managing and interacting with open windows within the game. ```csharp public System.Collections.Generic.IReadOnlyList ActiveWindows { get; } ``` -------------------------------- ### Rotate Dock Icon for ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Specifies whether the dock icon for this `ModWindow` should be rotated to face upwards in a 16x9 aspect ratio dock setup. This setting impacts the visual orientation of the icon in the dock. ```csharp public virtual bool RotateDockIcon { get; } ``` -------------------------------- ### Get Expert Button - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the 'Expert' difficulty button from the Map Select UI if the user is currently on the map selection screen. Returns a UnityEngine.UI.Toggle object representing the button, or null if not found. ```csharp public static Toggle GetExpertButton(); ``` -------------------------------- ### Get Intermediate Button - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the 'Intermediate' difficulty button from the Map Select UI if the user is currently on the map selection screen. Returns a UnityEngine.UI.Toggle object representing the button, or null if not found. ```csharp public static Toggle GetIntermediateButton(); ``` -------------------------------- ### Get Extreme Button - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the 'Extreme' difficulty button from the Map Select UI if the user is currently on the map selection screen. Returns a UnityEngine.UI.Toggle object representing the button, or null if not found. ```csharp public static Toggle GetExtremeButton(); ``` -------------------------------- ### Get Map Select Scene - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the current Unity Scene object if the user is on the map selection menu. This method returns a nullable Scene, indicating that it might be null if not on the correct screen. It utilizes the UnityEngine.SceneManagement namespace. ```csharp public static System.Nullable GetScene(); ``` -------------------------------- ### Create AudioClip from Various Wave Formats Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Internal Provides methods to create an AudioClip from different audio file types, including Ogg Vorbis, MP3, and WAV files, using NAudio library readers. Each method takes a reader object and a unique ID for the AudioClip. ```csharp public static AudioClip CreateAudioClip(NAudio.Vorbis.VorbisWaveReader reader, string id); ``` ```csharp public static AudioClip CreateAudioClip(NAudio.Wave.Mp3FileReader reader, string id); ``` ```csharp public static AudioClip CreateAudioClip(NAudio.Wave.WaveFileReader reader, string id); ``` ```csharp public static AudioClip CreateAudioClip(NAudio.Wave.WaveStream reader, string id); ``` -------------------------------- ### Set and Get Round Set Override - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.Modded This snippet demonstrates how to get or set the current round set override using the RoundSetOverride property of the RoundSetChanger class. The property returns a string representing the chosen override or null if none is selected. ```csharp public static string RoundSetOverride { get; set; } ``` -------------------------------- ### WeaponModelBehaviorExt - Get Behaviors Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Extensions Methods for retrieving behaviors from a WeaponModel. ```APIDOC ## GetBehavior(this WeaponModel) Method ### Description Return the first Behavior of type T, or null if there isn't one. ### Method `public static T GetBehavior(this WeaponModel model) where T : Model` ### Type Parameters - **T** - The Behavior you want. ### Parameters #### Path Parameters - **model** (WeaponModel) - Required - The WeaponModel to get the behavior from. ### Request Example ```json { "model": "" } ``` ### Response #### Success Response (200) - **T** (T) - The behavior if found, otherwise null. #### Response Example ```json { "behavior": "" } ``` ## GetBehavior(this WeaponModel, int) Method ### Description Return the index'th Behavior of type T, or null. ### Method `public static T GetBehavior(this WeaponModel model, int index) where T : Model` ### Type Parameters - **T** - The Behavior you want. ### Parameters #### Path Parameters - **model** (WeaponModel) - Required - The WeaponModel to get the behavior from. - **index** (int) - Required - The index of the behavior to retrieve. ### Request Example ```json { "model": "", "index": 0 } ``` ### Response #### Success Response (200) - **T** (T) - The behavior if found, otherwise null. #### Response Example ```json { "behavior": "" } ``` ## GetBehavior(this WeaponModel, string) Method ### Description Return the first Behavior of type T whose name contains the given string, or null. ### Method `public static T GetBehavior(this WeaponModel model, string nameContains) where T : Model` ### Type Parameters - **T** - The Behavior you want. ### Parameters #### Path Parameters - **model** (WeaponModel) - Required - The WeaponModel to get the behavior from. - **nameContains** (string) - Required - A string that the behavior's name must contain. ### Request Example ```json { "model": "", "nameContains": "behaviorName" } ``` ### Response #### Success Response (200) - **T** (T) - The behavior if found, otherwise null. #### Response Example ```json { "behavior": "" } ``` ## GetBehaviors(this WeaponModel) Method ### Description Return all Behaviors of type T. ### Method `public static System.Collections.Generic.List GetBehaviors(this WeaponModel model) where T : Model` ### Type Parameters - **T** - The Behavior you want. ### Parameters #### Path Parameters - **model** (WeaponModel) - Required - The WeaponModel to get the behaviors from. ### Request Example ```json { "model": "" } ``` ### Response #### Success Response (200) - **List** (System.Collections.Generic.List) - A list of all behaviors of type T. #### Response Example ```json { "behaviors": [ "", "" ] } ``` ``` -------------------------------- ### Open ModHelperWindow Instance - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI The Open method is responsible for creating and displaying a new ModHelperWindow instance within the game. It returns a reference to the newly created ModHelperWindow object, allowing for further interaction. ```csharp public BTD_Mod_Helper.Api.Components.ModHelperWindow Open(); ``` -------------------------------- ### ModHelperHttp.DownloadFile Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Asynchronously downloads a file from a given URL to a specified local file path. ```APIDOC ## ModHelperHttp.DownloadFile(string url, string filePath) ### Description Asynchronously downloads a file from a URL to a given file path. Returns a boolean indicating success. ### Method `Task` ### Endpoint N/A (This is a client-side method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **url** (`string`) - Required - The URL of the file to download. - **filePath** (`string`) - Required - The local path where the file will be saved. ### Request Example ```csharp // Example usage: bool success = await ModHelperHttp.DownloadFile("http://example.com/file.zip", "C:\Downloads\file.zip"); ``` ### Response #### Success Response (bool) - **`true`**: The file was downloaded successfully. - **`false`**: The download operation failed. #### Response Example ```json // The method returns a boolean value, not a JSON response. true ``` ``` -------------------------------- ### ModHelper Properties Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Provides access to various directories and information about the game and loaded mods. ```APIDOC ## ModHelper.DisabledModsDirectory Property Directory where disabled mods are stored ```csharp public static string DisabledModsDirectory { get; } ``` **Property Value:** System.String ``` ```APIDOC ## ModHelper.InstalledVersion Property The current installed version of Mod Helper ```csharp public static string InstalledVersion { get; } ``` **Property Value:** System.String ``` ```APIDOC ## ModHelper.IsEpic Property Gets whether the game is running as the Epic Store version ```csharp public static bool IsEpic { get; } ``` **Property Value:** System.Boolean ``` ```APIDOC ## ModHelper.IsNet6 Property Gets whether this is running on net6 MelonLoader ```csharp public static bool IsNet6 { get; } ``` **Property Value:** System.Boolean ``` ```APIDOC ## ModHelper.Melons Property All active mods, whether they're Mod Helper or not ```csharp public static System.Collections.Generic.IEnumerable Melons { get; } ``` **Property Value:** System.Collections.Generic.IEnumerable ``` ```APIDOC ## ModHelper.Mod Property ModHelper's BloonsTD6 mod class ```csharp public static BTD_Mod_Helper.BloonsTD6Mod Mod { get; } ``` **Property Value:** BTD_Mod_Helper.BloonsTD6Mod ``` ```APIDOC ## ModHelper.ModHelperDirectory Property Directory where Mod Helper stores most of its extra info ```csharp public static string ModHelperDirectory { get; } ``` **Property Value:** System.String ``` ```APIDOC ## ModHelper.Mods Property Active mods that use ModHelper functionality ```csharp public static System.Collections.Generic.IEnumerable Mods { get; } ``` **Property Value:** System.Collections.Generic.IEnumerable ``` ```APIDOC ## ModHelper.ModSourcesDirectory Property The directory path on the user's system that's set as their Mod Sources folder ```csharp public static string ModSourcesDirectory { get; } ``` **Property Value:** System.String ``` -------------------------------- ### ModSettingsMenu Methods Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.Menus Documentation for the methods available in the ModSettingsMenu class, including lifecycle methods and utility functions. ```APIDOC ## Method: ModSettingsMenu.OnMenuClosed() ### Description Runs right as your custom menu is being closed. ### Method Signature public override void OnMenuClosed(); ``` ```APIDOC ## Method: ModSettingsMenu.OnMenuOpened(Object) ### Description Runs right as your custom menu is being opened, with the optional data argument that can be passed into Open(Object, Object). ### Parameters - **data** (Il2CppSystem.Object) - Optional - The data argument that can be passed into Open. ### Returns System.Boolean - Whether to run the base menu's OnOpen code. ### Method Signature public override bool OnMenuOpened(Object data); ``` ```APIDOC ## Method: ModSettingsMenu.OnMenuUpdate() ### Description Runs every time that your custom menu updates. ### Method Signature public override void OnMenuUpdate(); ``` ```APIDOC ## Method: ModSettingsMenu.Open(MelonBase) ### Description Opens the Mod Settings for a specific mod. ### Parameters - **melon** (MelonLoader.MelonBase) - Required - The MelonBase instance for which to open settings. ### Method Signature public static void Open(MelonBase melon); ``` -------------------------------- ### ModHelperHttp.DownloadZip Method Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Downloads a zip file from a URL, extracts its contents, and saves them to a specified directory (or a temporary directory if none is provided). It returns a DirectoryInfo object representing the extracted files. This is useful for downloading and unpacking archives. ```csharp public static System.Threading.Tasks.Task DownloadZip(string url, string path=null); ``` -------------------------------- ### Get Affected TowerModels - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Towers This method retrieves the specific TowerModels within a given GameModel that will be affected by this mod. It returns an IEnumerable of TowerModel. ```csharp public override System.Collections.Generic.IEnumerable GetAffected(GameModel gameModel); ``` -------------------------------- ### ModHelperHttp.GetZip Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Downloads a zip file directly into a ZipArchive object. ```APIDOC ## ModHelperHttp.GetZip(string url) ### Description Downloads a zip file from a URL and returns it as a `ZipArchive` object, allowing direct access to its contents. ### Method `Task` ### Endpoint N/A (This is a client-side method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **url** (`string`) - Required - The URL of the zip file to download. ### Request Example ```csharp // Example usage: System.IO.Compression.ZipArchive zipArchive = await ModHelperHttp.GetZip("http://example.com/data.zip"); ``` ### Response #### Success Response (ZipArchive) - **`ZipArchive`**: An object representing the downloaded zip archive, allowing enumeration of its entries. #### Response Example ```json // The method returns a ZipArchive object, not a JSON response. // Example of what ZipArchive might represent: { "Entries": [ { "FullName": "file1.txt", "Length": 1024 }, { "FullName": "folder/file2.txt", "Length": 512 } ] } ``` ``` -------------------------------- ### ModHelperHttp.DownloadZip Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Downloads and extracts the contents of a zip file to a specified directory. ```APIDOC ## ModHelperHttp.DownloadZip(string url, string path = null) ### Description Downloads and extracts the contents of a zip file into a specified directory (or the default temp zip directory). Returns information about the extracted files. ### Method `Task` ### Endpoint N/A (This is a client-side method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **url** (`string`) - Required - The URL of the zip file to download. - **path** (`string`) - Optional - The directory path to extract the zip contents into. If null, the default zip temp directory is used. ### Request Example ```csharp // Example usage: System.IO.DirectoryInfo extractedFiles = await ModHelperHttp.DownloadZip("http://example.com/archive.zip"); // Or specify a path: // System.IO.DirectoryInfo extractedFiles = await ModHelperHttp.DownloadZip("http://example.com/archive.zip", "C:\ExtractedMods"); ``` ### Response #### Success Response (DirectoryInfo) - **`DirectoryInfo`**: An object representing the directory containing the extracted files. Returns null if the operation fails or the zip file is empty. #### Response Example ```json // The method returns a DirectoryInfo object, not a JSON response. // Example of what DirectoryInfo might represent: { "Name": "ExtractedArchive", "FullName": "C:\\Temp\\Zip\\ExtractedArchive", "Exists": true } ``` ``` -------------------------------- ### ModHelperHttp Class Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Provides an HTTP client for interacting with mod resources, including downloading files and zip archives. ```APIDOC ## ModHelperHttp Class ### Description This class provides an `HttpClient` instance for the mod helper and methods to download files and zip archives. ### Properties #### Client Property - **Description**: The `HttpClient` instance used by the mod helper. - **Type**: `System.Net.Http.HttpClient` - **Access**: `public static` ``` -------------------------------- ### ModHelperHttp.DownloadFile Method Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Asynchronously downloads a file from a specified URL to a given file path. It returns a boolean indicating the success of the operation. This method is useful for retrieving single files. ```csharp public static System.Threading.Tasks.Task DownloadFile(string url, string filePath); ``` -------------------------------- ### BTD_Mod_Helper.Api.Display Namespace Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/README Classes for creating custom displays for Bloons, Towers, Buffs, and more. ```APIDOC ## BTD_Mod_Helper.Api.Display Namespace ### Description This namespace provides a comprehensive set of classes for creating and managing custom visual displays within the game, including Bloons, Towers, Buff Icons, and 2D images. ### Classes * **ModBloonCustomDisplay**: A ModCustomDisplay that will automatically apply to a ModBloon. * **ModBloonCustomDisplay**: A ModCustomDisplay that will automatically apply to a ModBloon. * **ModBloonDisplay**: A ModDisplay that will automatically apply to a ModBloon. * **ModBloonDisplay**: A convenient generic class for applying a ModBloonDisplay to a ModBloon. * **ModBloonOverlay**: A special ModDisplay for Bloon Overlays. Handles automatically loading different instances of itself for each BloonOverlayClass. * **ModBuffIcon**: Class for adding a new buff icon that can be displayed for towers. * **ModCustomDisplay**: The custom version of a ModDisplay that loads in a model from a unity assetbundle. * **ModDisplay**: A custom Display that is a copy of an existing Display that can be modified. * **ModDisplay2D**: Mod Display specifically set up to be a 2d image. * **ModTowerCustomDisplay**: A ModCustomDisplay that will automatically apply to a ModTower for specific tiers. * **ModTowerCustomDisplay**: A convenient generic class for applying a ModTowerCustomDisplay to a ModTower. * **ModTowerDisplay**: A ModDisplay that will automatically apply to a ModTower for specific tiers. * **ModTowerDisplay**: A convenient generic class for applying a ModTowerDisplay to a ModTower. ``` -------------------------------- ### OpenScreenCommand Class Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Commands.Open Represents commands for opening UI screens within the BTD Mod Helper. It inherits from ModCommand and provides functionalities to execute commands and retrieve command details. ```APIDOC ## BTD_Mod_Helper.Api.Commands.Open.OpenScreenCommand ### Description Parent command for opening UI screens. ### Class `BTD_Mod_Helper.Api.Commands.OpenScreenCommand` ### Inheritance System.Object ◢ ModContent ◢ ModCommand ◢ BTD_Mod_Helper.Api.Commands.ModCommand ◢ OpenScreenCommand ### Properties #### `Command` Property - **Description**: The string name of this command. - **Type**: System.String - **Access**: public override string { get; } #### `Help` Property - **Description**: Short text description of this command. - **Type**: System.String - **Access**: public override string { get; } ### Methods #### `Execute(string)` Method - **Description**: Runs this command. - **Parameters**: - `resultText` (System.String) - Output parameter to store the result text of the command execution. - **Returns**: System.Boolean - Whether this command successfully executed. - **Access**: public override bool Execute(ref string resultText); ``` -------------------------------- ### Static Async JObject.LoadAsync Extension Method Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Extensions.HttpClientExtensions._G_%24E72F5683C860FEBD9E2DA889016900B3 This code defines a static class and method within HttpClientExtensions designed to asynchronously load JObject from an HTTP response. It's an extension method, implying it's used to add functionality to existing HTTP client objects. It likely takes an HttpClient and a URL as input and returns a JObject. ```csharp public static class HttpClientExtensions.$E72F5683C860FEBD9E2DA889016900B3.$E72F5683C860FEBD9E2DA889016900B3 ``` -------------------------------- ### Get Default Height of ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Returns the default height of the `ModWindow` when it is initially created or displayed. This property allows developers to set a standard height for their custom windows. ```csharp public virtual int DefaultHeight { get; } ``` -------------------------------- ### ModWindow Methods Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Details the methods available for the ModWindow class, including checking if the window should be hidden. ```APIDOC ## ModWindow Methods ### IsHidden() Method Checks whether this start menu entry should not appear in the menu at this time. ```csharp public override bool IsHidden(); ``` **Returns:** System.Boolean - Whether it's hidden or not. ``` -------------------------------- ### ModHelperHttp.GetZip Method Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Downloads a zip file from a URL and returns it as a ZipArchive object without extracting its contents. This method is suitable when you need to inspect or process the zip file contents directly in memory. ```csharp public static System.Threading.Tasks.Task GetZip(string url); ``` -------------------------------- ### Show Icon in ModWindow Dock Entry (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Indicates whether the icon for this `ModWindow` should be displayed in its corresponding dock entry. If `true`, the icon is visible; if `false`, only text (if available) is shown. ```csharp public virtual bool ShowIconInDock { get; } ``` -------------------------------- ### Get Dock Button Width for ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Specifies the width of the button that represents this `ModWindow` in the game's dock interface. This controls the visual size of the dock entry for the window. ```csharp public virtual int DockButtonWidth { get; } ``` -------------------------------- ### OpenCommand Execute Method - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Commands Executes the OpenCommand, attempting to open a specified file or folder. Returns a boolean indicating success and updates resultText with status. ```csharp public override bool Execute(ref string resultText); ``` -------------------------------- ### HttpClientExtensions LoadAsync Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Extensions.HttpClientExtensions._G_%24E72F5683C860FEBD9E2DA889016900B3 Provides an asynchronous extension method to load JObject from an HTTP client. ```APIDOC ## POST /websites/gurrenm3_github_io_btd-mod-helper/HttpClientExtensions/LoadAsync ### Description This endpoint provides an asynchronous extension method to load a JObject from an HTTP client. It is part of the BTD_Mod_Helper.Extensions.HttpClientExtensions class. ### Method POST ### Endpoint `/websites/gurrenm3_github_io_btd-mod-helper/HttpClientExtensions/LoadAsync` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body This method likely takes an `HttpClient` and a URL or request configuration as input, but the exact structure is not detailed in the provided text. ### Request Example ```json { "message": "Request body details not specified in source documentation." } ``` ### Response #### Success Response (200) - **JObject** (object) - The loaded JSON object from the response. #### Response Example ```json { "example": "{ \"some_key\": \"some_value\" }" } ``` ``` -------------------------------- ### Get Behavior from WeaponModel Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Extensions Retrieves behaviors from a WeaponModel. Supports finding the first behavior of type T, the index'th behavior, the first behavior matching a name, or all behaviors of type T. ```csharp public static T GetBehavior(this WeaponModel model) where T : Model; public static T GetBehavior(this WeaponModel model, int index) where T : Model; public static T GetBehavior(this WeaponModel model, string nameContains) where T : Model; public static System.Collections.Generic.List GetBehaviors(this WeaponModel model) where T : Model; ``` -------------------------------- ### OpenCommand Help Property - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Commands Provides a short text description of the OpenCommand. ```csharp public override string Help { get; } ``` -------------------------------- ### Add Texture to ResourceHandler Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Internal Adds a Texture2D to the ResourceHandler's cache, making it accessible later. The texture is identified by a unique string GUID, typically in the format "ModName-TextureName". ```csharp public static void AddTexture(string guid, Texture2D texture); ``` -------------------------------- ### Helpers Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/README This section describes various helper classes that simplify common modding tasks, such as working with abilities, attacks, costs, and file operations. ```APIDOC ## Helpers ### AbilityHelper **Description**: A wrapper around AbilityModels for making them easier to create. ### ActionHelper **Description**: Class for converting actions and functions. ### AttackHelper **Description**: A wrapper around AttackModels for making them easier to create. ### CostHelper **Description**: Helper for scaling costs to difficulties. ### FileDialogHelper **Description**: Class to help with the usage of Native File Dialogs. ### FileIOHelper **Description**: Class replacing the original functionality of FileIOUtil before BTD6 update 33.0. ### GameModelExporter **Description**: Class for handily exporting elements of the GameModel to JSON files. ### Il2CppEnumerator **Description**: Wrapper for il2cpp enumerator so that it actually extends the normal System enumerator. ### Il2CppEnumerator **Description**: Wrapper for il2cpp enumerator so that it actually extends the normal System enumerator. ### Instances **Description**: Provides quick access to many major BTD6 singleton classes. ### Lists **Description**: Provides quick access to many major BTD6 object lists. ### LocalizationHelper **Description**: Helps mods more easily support additional localization for their mod texts. ### MapHelper **Description**: Contains helper methods for working with maps and custom maps. ### MatchScale **Description**: Component to make this transform continuously match the scale of another transform. ### ModelHelper **Description**: A wrapper class around a Model. ### ModelHelper **Description**: A wrapper class around a Model. ### ModelSerializer **Description**: Handles serializing and deserializing models in a way that utilizes their actual constructors. ### ProcessHelper **Description**: Helper methods for processes. ### ProjectileHelper **Description**: A wrapper around ProjectileModels for making them easier to create. ### QuickEdit **Description**: Utility for allowing the user to quickly edit some input in an external program. ### SpriteResizer **Description**: Helper class for getting resized versions of Sprites. ### TimeHelper **Description**: Properties and methods for helping change in-game time / time-related values. ### WeaponHelper **Description**: A wrapper around WeaponModels for making them easier to create. ``` -------------------------------- ### Load ModHelperWindow State - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI The LoadWindow method is invoked when a custom window is loaded in a new game session, using saved data to restore its state. It takes the ModHelperWindow instance and a JObject containing the saved data as parameters. This method is virtual, allowing for custom implementations. ```csharp public virtual void LoadWindow(BTD_Mod_Helper.Api.Components.ModHelperWindow window, JObject saveData); ``` -------------------------------- ### Get Texture by ID Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Internal Retrieves a Texture2D from the ResourceHandler's cache using its ID. The ID format is "ModName-FileName" without the extension. If the texture is not found, it attempts to load and cache it. ```csharp public static Texture2D GetTexture(string id); ``` -------------------------------- ### ModGameMode Class Documentation Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Scenarios Documentation for the ModGameMode class, which serves as a base for custom game modes. ```APIDOC ## ModGameMode Class Class for a custom GameMode that will be added to the modes screen when starting a new match. ### Properties * **ApplyChallengeRules** (virtual bool) - Whether this Game Mode should always apply custom challenge rules to the match via a DailyChallengeModel. * **BaseGameMode** (abstract string) - The id of the existing GameMode to use as a base. Use GameModeType.[name]. If this GameModeType.None, empty, or null, then an empty base will be used. * **Difficulty** (abstract string) - Where this Mode should show up within the Mode Select screen. Use DifficultyType.[name]. * **DisplayNamePlural** (sealed override string) - The name that will actually be displayed when referring to multiple of these. * **Icon** (virtual string) - The Icon for the Button for this Mode within the UI, by default looking for the same name as the file. * **IconReference** (virtual SpriteReference) - If you're not going to use a custom .png for your Icon, use this to directly control its SpriteReference. ### Methods * **ModifyBaseGameModeModel**(ModModel gameModeModel) - Abstract method implemented by a ModGameMode to modify the base game mode, for instance by adding or removing mutator mods. * **Parameters**: * `gameModeModel` (ModModel) - The game mode model to modify. * **ModifyChallengeRules**(DailyChallengeModel challengeModel) - Virtual method to modify the DailyChallengeModel used for the challenge rules of the match. If this mode is used in a custom challenge, this will override the settings of that challenge. For normal matches, the DailyChallengeModel is null. To make normal matches have challenge rules, set the ApplyChallengeRules property to true. * **Parameters**: * `challengeModel` (DailyChallengeModel) - The challenge model to modify. * **ModifyGameModel**(GameModel gameModel) - Virtual method to modify the GameModel that's used for matches played with this mode. * **Parameters**: * `gameModel` (GameModel) - The game model to modify. ``` -------------------------------- ### Handle Menu Opening Event - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.Menus An override method that is executed when the custom mod settings menu is opened. It can receive optional data passed during the opening process and determines if the base menu's OnOpen code should execute. ```csharp public override bool OnMenuOpened(Object data) { // Optional: Add custom logic here return true; // Set to false to prevent base menu's OnOpen code } ``` -------------------------------- ### ModHelper ModSourcesDirectory Property Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Retrieves the directory path configured as the user's Mod Sources folder. This static property returns a string. ```csharp public static string ModSourcesDirectory { get; } ``` -------------------------------- ### Get Top Bar Height of ModWindow (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI Returns the height of the top bar of the `ModWindow`, which typically contains the close, settings, and minimize buttons. This property allows customization of the top bar's vertical space. ```csharp public virtual int TopBarHeight { get; } ``` -------------------------------- ### ModHelper Methods Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Provides methods for logging errors, messages, and warnings, as well as utility functions for retrieving and checking for mods. ```APIDOC ## ModHelper.Error(object) Method Logs an error from the specified Mod's LoggerInstance ```csharp public static void Error(object obj) where T : BTD_Mod_Helper.BloonsMod; ``` **Type parameters:** `T`: The type of the mod to associate the error log with. **Parameters:** - `obj` (System.Object) - The object to log as an error. ``` ```APIDOC ## ModHelper.GetMod(string) Method Gets a BloonsTD6Mod by its name, or returns null if none are loaded with that name. In this case, a mod's name is its Assembly Name, which is almost always the same as the file name, but for the Mod Helper due to compatibility reasons, it is "BloonsTD6 Mod Helper" rather than "Btd6ModHelper". ```csharp public static BTD_Mod_Helper.BloonsMod GetMod(string name); ``` **Parameters:** - `name` (System.String) - The name of the mod to retrieve. **Returns:** BTD_Mod_Helper.BloonsMod - The loaded mod instance, or null if not found. ``` ```APIDOC ## ModHelper.GetMod() Method Gets the instance of a specific BloonsTD6Mod by its type. ```csharp public static T GetMod() where T : BTD_Mod_Helper.BloonsMod; ``` **Type parameters:** `T`: The type of the mod to retrieve. **Returns:** T - The instance of the specified mod type. ``` ```APIDOC ## ModHelper.HasMod(string) Method Returns whether a mod with the given name is installed. ```csharp public static bool HasMod(string name); ``` **Parameters:** - `name` (System.String) - The name of the mod to check for. **Returns:** System.Boolean - True if the mod is installed, false otherwise. ``` ```APIDOC ## ModHelper.HasMod(string, out BloonsMod) Method Returns whether a mod with the given name is installed, and pass it to the out param if it is. ```csharp public static bool HasMod(string name, out BTD_Mod_Helper.BloonsMod bloonsMod); ``` **Parameters:** - `name` (System.String) - The name of the mod to check for. - `bloonsMod` (BTD_Mod_Helper.BloonsMod) - Output parameter that will be populated with the mod instance if found. **Returns:** System.Boolean - True if the mod is installed, false otherwise. ``` ```APIDOC ## ModHelper.Log(object) Method Logs a message from the specified Mod's LoggerInstance. ```csharp public static void Log(object obj) where T : BTD_Mod_Helper.BloonsMod; ``` **Type parameters:** `T`: The type of the mod to associate the log with. **Parameters:** - `obj` (System.Object) - The object to log. ``` ```APIDOC ## ModHelper.Msg(object) Method Logs a message from the specified Mod's LoggerInstance. ```csharp public static void Msg(object obj) where T : BTD_Mod_Helper.BloonsMod; ``` **Type parameters:** `T`: The type of the mod to associate the message with. **Parameters:** - `obj` (System.Object) - The object to log as a message. ``` ```APIDOC ## ModHelper.Warning(object) Method Logs a warning from the specified Mod's LoggerInstance. ```csharp public static void Warning(object obj) where T : BTD_Mod_Helper.BloonsMod; ``` **Type parameters:** `T`: The type of the mod to associate the warning log with. **Parameters:** - `obj` (System.Object) - The object to log as a warning. ``` -------------------------------- ### Load Audio from Asset Bundle or Embedded Resource Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Audio Specifies how to load the audio clip for a Jukebox track. Set AssetBundleName to load from an embedded AssetBundle, or provide AudioClipName for directly embedded audio resources. ```csharp public virtual string AssetBundleName { get; } ``` ```csharp public virtual string AudioClipName { get; } ``` -------------------------------- ### Get MapSelectUI Canvas - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the main Canvas object associated with the Map Select UI. This can be useful for manipulating UI elements or obtaining layout information. Returns a UnityEngine.Canvas object or null. ```csharp public static Canvas GetCanvas(); ``` -------------------------------- ### ModHelperHttp.Client Property Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.ModMenu Provides access to the static HttpClient instance used for all HTTP requests within the ModHelperHttp class. This allows for reusing the same HttpClient across multiple operations. ```csharp public static System.Net.Http.HttpClient Client { get; set; } ``` -------------------------------- ### ModHelper IsEpic Property Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper Checks if the game is currently running as the Epic Store version. This static boolean property returns true if it's the Epic Store version, false otherwise. ```csharp public static bool IsEpic { get; } ``` -------------------------------- ### Get Advanced Button - C# Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Retrieves the 'Advanced' difficulty button from the Map Select UI if the user is currently on the map selection screen. Returns a UnityEngine.UI.Toggle object representing the button, or null if not found. ```csharp public static Toggle GetAdvancedButton(); ``` -------------------------------- ### Get Bloon IDs for Modification (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Bloons Abstract property BloonIds specifies the collection of vanilla Bloon IDs that this mod should affect. Implementations must provide a concrete list of Bloon IDs to be modified. This is a core component for targeting specific Bloons. ```csharp public abstract System.Collections.Generic.IEnumerable BloonIds { get; } ``` -------------------------------- ### WeaponHelper Constructor Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Helpers Initializes a new instance of the WeaponHelper class with a specified name. This constructor sets up a new WeaponModel with sensible default values, making it easier to begin defining weapon properties. ```csharp public WeaponHelper(string name=""); ``` -------------------------------- ### ModSettingsMenu.Melon Property Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.Menus Provides access to the most recent mod with opened settings. ```APIDOC ## Property: ModSettingsMenu.Melon ### Description The most recent mod with opened settings. ### Property Value MelonLoader.MelonBase ``` -------------------------------- ### Get Sprite by ID Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Internal Retrieves a Sprite from the ResourceHandler's cache using its ID. If the sprite is not found, it attempts to create and cache it. The ID format is "ModName-FileName" without the extension, and an optional pixels per unit value can be specified. ```csharp public static Sprite GetSprite(string id, float pixelsPerUnit=10.8f); ``` -------------------------------- ### Enums Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/README This section details the available enums within the BTD Mod Helper API, which provide predefined constants for various game elements. ```APIDOC ## Enums ### ModHelperSprites **Description**: Texture GUIDs for the couple sprites added by ModHelper. ### RoundSetType **Description**: In-game IDs for the round sets included in BTD6. ### TowerSetType **Description**: Enum-like class for the different tower set types. ### CustomShader **Description**: Custom Shaders added by Mod Helper. ### ScheduleType **Description**: Controls how you want to wait the Task Scheduler to wait for your tasks. ``` -------------------------------- ### Hooks Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/README This section covers the classes and structures related to implementing method hooks, allowing mods to intercept and modify game behavior. ```APIDOC ## Hooks ### HookPriorityAttribute **Description**: Specifies the priority of this hook compared to others. ### HookTargetAttribute **Description**: Specifies the target type and hook type for a method hook. ### ModHook **Description**: Provides a base mod hook for intercepting and modifying method calls using prefix and postfix hooks. ### HookNullable **Description**: Provides a simplified nullable type for unmanaged types, used as a replacement for Il2CPP's nullable implementation. ### HookTargetAttribute.EHookType **Description**: Represents the type of hook to apply. ### ModHook.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(MethodInfo) **Description**: Delegate for retrieving the FieldInfo pointer for a generated method's Il2Cpp method info. ``` -------------------------------- ### MapSelectUI Class Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.UI.BTD6 Provides access to the game's Map Select UI elements. ```APIDOC ## MapSelectUI Class ### Description Class to access the game's Map Select UI. ### Methods #### GetAdvancedButton() Gets the Advanced Button if on the Map Select Menu, or null. - **Returns**: `UnityEngine.UI.Toggle` #### GetBeginnerButton() Gets the Beginner Button if on the Map Select Menu, or null. - **Returns**: `UnityEngine.UI.Toggle` #### GetCanvas() Gets the Canvas for the MapSelectUI, or null. - **Returns**: `UnityEngine.Canvas` #### GetExpertButton() Gets the Expert Button if on the Map Select Menu, or null. - **Returns**: `UnityEngine.UI.Toggle` #### GetExtremeButton() Gets the Extreme Button if on the Map Select Menu, or null. - **Returns**: `UnityEngine.UI.Toggle` #### GetIntermediateButton() Gets the Intermediate Button if on the Map Select Menu, or null. - **Returns**: `UnityEngine.UI.Toggle` #### GetScene() Gets the Scene if on the Map Select menu. - **Returns**: `System.Nullable` ``` -------------------------------- ### Define Abstract ModWindow Class (C#) Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.UI This code defines the abstract base class `ModWindow` for creating custom in-game windows. It inherits from `ModStartMenuEntry` and serves as a blueprint for windows managed by the BTD Mod Helper. Developers extend this class to create specific window functionalities. ```csharp public abstract class ModWindow : BTD_Mod_Helper.Api.UI.ModStartMenuEntry ``` -------------------------------- ### OpenCommand Class Source: https://gurrenm3.github.io/BTD-Mod-Helper/docs/BTD_Mod_Helper.Api.Commands Provides commands for opening specific files or folders within the BTD Mod Helper application. ```APIDOC ## OpenCommand Class ### Description Commands for opening specific files / folders. ### Inheritance System.Object ⇒ ModContent ⇒ ModCommand ⇒ OpenCommand ### Properties #### OpenCommand.Command Property - **Description**: The string name of this command. - **Type**: System.String - **Access**: public override string Command { get; } #### OpenCommand.Help Property - **Description**: Short text description of this command. - **Type**: System.String - **Access**: public override string Help { get; } ### Methods #### OpenCommand.Execute(string) Method - **Description**: Runs this command. - **Parameters**: - `resultText` (System.String) - Output parameter to store the result text. - **Returns**: System.Boolean - Whether this command successfully executed. - **Access**: public override bool Execute(ref string resultText); ### Request Example ```json { "command": "open", "target": "path/to/your/file.txt" } ``` ### Response Example ```json { "success": true, "message": "File opened successfully." } ``` ```