### Access Tidy 5e Sheets API
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/7.-Developer-API
Get the Tidy 5e Sheets API object from the game module. This is the entry point for all API interactions.
```javascript
const api = game.modules.get('tidy5e-sheet').api;
```
--------------------------------
### Cleric Max Prepared Spells Formula
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/8.-Helpful-Resources
Calculates the maximum prepared spells for a Cleric. Use this formula when the Cleric's spellcasting ability is Wisdom.
```plaintext
max(@abilities.wis.mod + @classes.cleric.levels, 1)
```
--------------------------------
### Paladin Max Prepared Spells Formula
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/8.-Helpful-Resources
Calculates the maximum prepared spells for a Paladin. Use this formula when the Paladin's spellcasting ability is Charisma.
```plaintext
max(@abilities.cha.mod + floor(@classes.paladin.levels / 2), 1)
```
--------------------------------
### Wizard Max Prepared Spells Formula
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/8.-Helpful-Resources
Calculates the maximum prepared spells for a Wizard. Use this formula when the Wizard's spellcasting ability is Intelligence.
```plaintext
max(@abilities.int.mod + @classes.wizard.levels, 1)
```
--------------------------------
### Druid Max Prepared Spells Formula
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/8.-Helpful-Resources
Calculates the maximum prepared spells for a Druid. Use this formula when the Druid's spellcasting ability is Wisdom.
```plaintext
max(@abilities.wis.mod + @classes.druid.levels, 1)
```
--------------------------------
### Artificer Max Prepared Spells Formula
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/wiki/8.-Helpful-Resources
Calculates the maximum prepared spells for an Artificer. Use this formula when the Artificer's spellcasting ability is Intelligence.
```plaintext
max(@abilities.int.mod + floor(@classes.artificer.levels / 2), 1)
```
--------------------------------
### Inject HTML into Tidy 5e Modern Sheets
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/blob/main/src/api/README.md
This snippet demonstrates how to inject custom HTML, such as a level-up button, into Tidy 5e Modern actor sheets. It uses the `renderActorSheetV2` hook and targets the actor name element for insertion. The `data-tidy-render-scheme="handlebars"` attribute ensures the injected content re-renders on partial or full sheet updates.
```javascript
// Every time an actor renders, whether a full render or a partial
Hooks.on("renderActorSheetV2", (sheet, element, data) => {
const isTidySheet = element.classList.contains('tidy5e-sheet');
if (!isTidySheet) {
return;
}
// Here's some HTML
const levelUpButton = `
`;
// pro tip: `data-tidy-render-scheme="handlebars"` causes this content to re-render on every Tidy render, full or partial
// insert the HTML
element
.querySelector('[data-tidy-sheet-part="actor-name"]')
.insertAdjacentHTML("afterend", levelUpButton);
});
```
--------------------------------
### Inject HTML into Tidy 5e Classic Sheets
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/blob/main/src/api/README.md
This snippet shows how to inject custom HTML into Tidy 5e Classic actor sheets using the `tidy5e-sheet.renderActorSheet` hook. Similar to the modern sheets, it inserts a level-up button next to the name container and utilizes `data-tidy-render-scheme="handlebars"` for dynamic re-rendering.
```javascript
// Every time Tidy renders, whether a full render or a partial
Hooks.on("tidy5e-sheet.renderActorSheet", (sheet, element, data) => {
// Here's some HTML
const levelUpButton = `
`;
// pro tip: `data-tidy-render-scheme="handlebars"` causes this content to re-render on every Tidy render, full or partial
// insert the HTML
element
.querySelector('[data-tidy-sheet-part="name-container"]')
.insertAdjacentHTML("afterend", levelUpButton);
});
```
--------------------------------
### Link Issue in Pull Request Title
Source: https://github.com/kgar/foundry-vtt-tidy-5e-sheets/blob/main/CONTRIBUTING.md
When submitting a pull request, link it to an open issue by including the issue number in the title, prefixed with '#'. This helps track which issue the PR resolves.
```markdown
[#32] Resolves STR Check Click Bug
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.