From 583705e75b80562d126bf013d948539743ab820b Mon Sep 17 00:00:00 2001 From: Anderson Lima Date: Sun, 29 Oct 2023 02:24:40 -0300 Subject: [PATCH] update docs --- src/common/types.js | 49 +++++++++++++++++++++++++++++++++ src/features/character-sheet.js | 4 +-- src/features/enhancement.js | 2 +- src/features/powers.js | 6 ++-- src/features/spells.js | 6 ++-- 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src/common/types.js b/src/common/types.js index ca4ebe2..6606f90 100644 --- a/src/common/types.js +++ b/src/common/types.js @@ -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.>} + */ + +/** + * @typedef PowerData + * @type {object.>} + */ diff --git a/src/features/character-sheet.js b/src/features/character-sheet.js index 6158541..17cc674 100644 --- a/src/features/character-sheet.js +++ b/src/features/character-sheet.js @@ -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 diff --git a/src/features/enhancement.js b/src/features/enhancement.js index 5744721..75f85fa 100644 --- a/src/features/enhancement.js +++ b/src/features/enhancement.js @@ -11,7 +11,7 @@ * * @param {object} props * @param {HTMLDivElement} message - The roll20 chat message. - * @param {object} conditionsMap - All conditions. TODO: Document + * @param {object.} conditionsMap - All conditions. */ function enhanceMessage({ message, conditionsMap }) { Object.keys(conditionsMap).map((condition) => { diff --git a/src/features/powers.js b/src/features/powers.js index 7c9c8f2..90abee9 100644 --- a/src/features/powers.js +++ b/src/features/powers.js @@ -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; @@ -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 @@ -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 }) { diff --git a/src/features/spells.js b/src/features/spells.js index 0e1c254..44ef746 100644 --- a/src/features/spells.js +++ b/src/features/spells.js @@ -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; @@ -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 @@ -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 }) {