Created
June 7, 2025 12:46
-
-
Save oneeyedman/a5329a972f829cae25585d6b98137312 to your computer and use it in GitHub Desktop.
Función que pilla los hechizos de la ficha abierta de Foundry y me hace un array espartanao para que me los pueda ordenar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSpells() { | |
const spellBlocks = document.querySelectorAll('.spells-list .items-section.card'); | |
const spells = [...spellBlocks].map(block => [...block.querySelectorAll('.item')].map(spell => { | |
const lvl = spell.closest('.items-section.card').dataset.level | |
const prepared = spell.querySelector('.item-action.active')?.getAttribute('aria-label') ?? '<'; | |
return { | |
name: spell.dataset.itemName, | |
lvl, | |
prepared | |
} | |
})) | |
console.log(spells) | |
} | |
getSpells(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment