Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pyanderson committed Oct 29, 2023
1 parent 43ff221 commit 583705e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 deletions.
49 changes: 49 additions & 0 deletions src/common/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,52 @@
* @property {string} content - If the book item type is 'table', this is the table content in the TSV format.
* @property {BookItem[]} items - If the book item type is 'folder', this is a list of book item.
*/

/**
* @typedef Spell
* @type {object}
* @property {string} area - Eg.: Esfera de 9m de raio
* @property {string} circle - Eg: 1
* @property {string} description - Eg.: Você cria uma barreira protetora invisível que detecta qualquer criatura...
* @property {string} duration - Eg.: cena
* @property {string} effect - Eg.: domo com 6m de raio
* @property {string} execution - Eg.: padrão
* @property {Implement[]} implements
* @property {string} name - Eg.: Raio Solar
* @property {string} range - Eg.: médio
* @property {string} resistance - Eg.: Reflexos
* @property {string} target - Eg.: 1 criatura
* @property {string} type - Eg.: Universal 2 (Abjuração)
*/

/**
* @typedef Implement
* @type {object}
* @property {string} cost - Eg.: +3 PM
* @property {string} description - Eg.: muda o alvo para “você” e o alcance para “pessoal”.
*/

/**
* @typedef Power
* @type {object}
* @property {string} name - Eg.: Versátil
* @property {string} description - Eg.: Você se torna treinado em duas perícias a sua escolha...
*/

/**
* @typedef T20Data
* @type {object}
* @property {SpellData} spells
* @property {PowerData} powers
* @property {string[]} powersOptions
*/

/**
* @typedef SpellData
* @type {object.<(1|2|3|4|5), object.<string, Spell>>}
*/

/**
* @typedef PowerData
* @type {object.<string, object.<string, Power>>}
*/
4 changes: 2 additions & 2 deletions src/features/character-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ function loadSheetExtraCSS({ iframe }) {
* Load the sheet improvements.
*
* @param {object} props
* @param {object} props.spells - The spells data. TODO: Document
* @param {object} props.powers - The powers data. TODO: Document
* @param {SpellData} props.spells - The spells data.
* @param {PowerData} props.powers - The powers data.
* @param {string} props.characterId - The character ID in the Roll20 game.
*/
// eslint-disable-next-line no-unused-vars
Expand Down
2 changes: 1 addition & 1 deletion src/features/enhancement.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @param {object} props
* @param {HTMLDivElement} message - The roll20 chat message.
* @param {object} conditionsMap - All conditions. TODO: Document
* @param {object.<string, BookItem>} conditionsMap - All conditions.
*/
function enhanceMessage({ message, conditionsMap }) {
Object.keys(conditionsMap).map((condition) => {
Expand Down
6 changes: 3 additions & 3 deletions src/features/powers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @param {object} props
* @param {HTMLDivElement} props.container - The container to be filled.
* @param {object} props.power - The Tormenta20 data. TODO: Document
* @param {Power} props.power - The Tormenta20 data.
*/
function fillPowerContainer({ container, power }) {
if (power === undefined) return;
Expand All @@ -31,7 +31,7 @@ function fillPowerContainer({ container, power }) {
*
* @param {object} props
* @param {HTMLDivElement} props.container - The container to be filled.
* @param {object} props.data - The Tormenta20 data. TODO: Document
* @param {T20Data} props.data - The Tormenta20 data.
*/
function renderPowerButton({ container, data }) {
if (container.querySelector('button[name="choose-power"]')) return; // if the button already exists, ignore
Expand Down Expand Up @@ -102,7 +102,7 @@ function renderPowerButton({ container, data }) {
*
* @param {object} props
* @param {HTMLDocument} props.iframe - The character sheet iframe document.
* @param {object} props.data - The Tormenta20 data. TODO: Document
* @param {T20Data} props.data - The Tormenta20 data.
*/
// eslint-disable-next-line no-unused-vars
function renderPowersButtons({ iframe, data }) {
Expand Down
6 changes: 3 additions & 3 deletions src/features/spells.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function calcCD({ iframe }) {
* @param {object} props
* @param {HTMLDocument} props.iframe - The character sheet iframe document.
* @param {HTMLDivElement} props.container - The container to be filled.
* @param {object} props.spell - The spell data. TODO: Document
* @param {Spell} props.spell - The spell data.
*/
function fillSpellContainer({ iframe, container, spell }) {
if (spell === undefined) return;
Expand Down Expand Up @@ -112,7 +112,7 @@ function fillSpellContainer({ iframe, container, spell }) {
* @param {HTMLDocument} props.iframe - The character sheet iframe document.
* @param {HTMLDivElement} props.container - The container to be filled.
* @param {string} props.circle - The spell circle.
* @param {object} props.data - The Tormenta20 data. TODO: Document
* @param {T20Data} props.data - The Tormenta20 data.
*/
function renderSpellButton({ iframe, container, circle, data }) {
if (container.querySelector('button[name="choose-spell"]')) return; // if the button already exists, ignore
Expand Down Expand Up @@ -183,7 +183,7 @@ function renderSpellButton({ iframe, container, circle, data }) {
*
* @param {object} props
* @param {HTMLDocument} props.iframe - The character sheet iframe document.
* @param {object} props.data - The Tormenta20 data. TODO: Document
* @param {T20Data} props.data - The Tormenta20 data.
*/
// eslint-disable-next-line no-unused-vars
function renderSpellsButtons({ iframe, data }) {
Expand Down

0 comments on commit 583705e

Please sign in to comment.