LegendAPI
Modding API for Wizard of Legend.
About this mod Author’s original text
LegendAPI - A Modding API for Wizard of Legend
About
LegendAPI is a framework for other mods to help integrate their content with the game in a way compatible with both other mods and with vanilla systems other than the one being directly modified.
Manual Installation
The contents of the release should be extracted into the plugins folder under your BepInEx installation,\
This project requires a valid installation of both BepInEx (version 4.5.\* or later) and also of HookGenPatcher
Building
After cloning the repo, place the necessary library files in a folder named libs one level above the repo, afterwards run dotnet build.
Basic Usage (by Module)
The core idea behind using LegendAPI as a mod developer is that you write your content as if it was a part of the main game and then provide LegendAPI with info regarding it so that it can do the necessary modifications for the game to accept it.\
There are various modules that facilitate this.\
Unless stated otherwise all Info fields can be expected to have sane default values.
Items
An Item is implemented by first writing a class inheriting from either any other item or the vanilla Item class, after doing so the following details can be provided to LegendAPI:
ItemInfo {
Item item; //An instance of your item
string name; //The name of your item.
int tier; //The 'tier' that your item is in, this determines internal values such as rarity and base price.
global::TextManager.ItemInfo text; //The user facing text your item has, made up of it's internal-id, a display name and a description.
string group; //The internal-id of any group/bundle items that this item might belong to.
Sprite icon; // The inventory & world sprite for your item.
int priceMultiplier; //The direct price multiplier of your item, set to 0 to make it free.
Func unlockCondition; //A function that takes nothing and returns a bool, this delegate will be called to decide whether the item is eligible for sale at the Plaza's Item Shop. It can either check another condition or return false for fully custom unlocks.
}
This data can then be passed to the API by calling LegendAPI.Items.Register(), any items that this one can combine into should be registered using LegendAPI.Items.RegisterRecipe().\
This module is compatible with Replace Mode Registering, which means that providing an ItemInfo matching to an existing (vanilla or modded) item will allow you to change it's values.
Outfits
An Outfit is made by creating a new instance of the vanilla Outfit class. However, to make use of LegendAPI's outfit related functionality requires that the outfit's modList field contains an entry of LegendAPI.Outfits.CustomModType, it can also include other OutfitStatMods without issue.\
An entry of LegendAPI.Outfits.CopyCatModType replicates vanilla secret cloak behavior.\
Afterwards, the following info can be filled out:
OutfitInfo {
Outfit outfit; //The outfit instance you created, note the requirement of a CustomModType entry mentioned above.
string name; //The display name of the outfit.
Func unlockCondition; //A function that takes nothing and returns a bool, provided that the outfit isn't unlocked by default(a field in the Outfit class), this delegate will be called to decide whether the player has earned the outfit.
Action customMod; //The Custom Modifier, this is the workhorse that weaves your custom outfit effects into being, this delegate takes, in order, the player in question, whether the effect is being turned on or off, if it's being called due to a change in outfits or otherwise and the outfitmodstat instace being activated.
Func customDesc; //The display description of the outfit's abilities, it is provided as a delegate to take advantage of live shifts in values, the input of the delegate refers to whether it's being displayed in a context where providing stat numbers is appropriate as well as the outfitmodstat instance used.
}
This data can then be passed to the API by calling LegendAPI.Outfits.Register().\
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide.
Install these first, or the mod will not work: