# Mods Menu
Library that adds a category in the options for mods.

## How to implement it in your mods
* Make a reference to this .dll in your project.
* Add the dependency in your plugin declaration.
```
[BepInDependency("eradev.monstersanctuary.ModsMenu")]
public class Plugin : BaseUnityPlugin
```
* Add a RegisterOptionsEvt bloc somewhere your startup code. It will be launched when the menu is created in-game.
```
ModsMenu.RegisterOptionsEvt += (_, _) =>
{
...
}
```
* Inside it, you may add your mod option(s):
```
ModsMenu.TryAddOption(
PluginInfo.PLUGIN_NAME, // <- Your plugin name. Make it short as it will be displayed next to your option's name. (string, required)
"Enabled", // <- Name of your option. (string, required)
() => $"{_isEnabled.Value}", // <- How your value will be displayed next to your option name. (Func<string>, required)
// Optional parameters below
onValueChangeFunc: (direction) => _isEnabled.Value = !_isEnabled.Value, // <- If it's not null, it will show the two arrows next to the option, allowing the user to increase/decrease or switch the value. direction is an int that indicates if the left or right arrow was used. (Action<int>, defaults: null)
possibleValuesFunc: () => listOfValues, // <- If it's not null, when the user selects an option, a popup will appear with the returned values so the user can select one. (Func<List<string>>, default: null)
onValueSelectFunc: (newValue) => _isEnabled.Value = bool.Parse(newValue), // <- Used with possibleValuesFunc. What happens when the user selects a value from the popup. newValue is always a string so you need to make appropriate manipulations if it's another type. (Action<string>, default: null)
determineDisabledFunc: () => _isGlobalEnabled.Value, // <- If it's not null, it will be checked to see if we need to disable the option. (Func<bool>, default: null)
disabledInGameMenu: false, // <- Is the modification disabled in a game (not in the main menu) (bool, default: false)
setDefaultValueFunc: () => _isEnabled.Value = false // <- If it's not null, it will be executed when the player selects the Defaults button. (Action, default: null)
);
```
## Bugs and suggestions
If you encounter any bugs, or have suggestions, please open an issue at https://github.com/Eradev/MonsterSanctuaryMods, or contact **Eradev#1842** in the Monster Sanctuary Discord.
# Changelog
## 1.0.2
* Fixed navigation bug
* Removed incompatility with "evaisa.MonSancAPI"
## 1.0.1
Reordered parameters so it makes more sense.
## 1.0.0
Initial release.
Dependencies
-
Instructions
* Get the latest version of BepInEx 5. (https://github.com/BepInEx/BepInEx/releases/)
* Put the .dll in the BepInEx\plugins folder.
Simply remove the .dll if you want to uninstall it.
Comments