From eb36ce67ae18516f5ffa97356904f0d9e4a75f65 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Mon, 6 Dec 2021 10:45:53 +0100 Subject: [PATCH] Cohort sheet : added symbol translation for abilities --- system/scripts/items/army-cohort-sheet.js | 29 +++++++++++++++++++ .../gm/monitor-tooltips/global-armies.html | 9 ++++++ 2 files changed, 38 insertions(+) diff --git a/system/scripts/items/army-cohort-sheet.js b/system/scripts/items/army-cohort-sheet.js index 5035467..6d98c3c 100644 --- a/system/scripts/items/army-cohort-sheet.js +++ b/system/scripts/items/army-cohort-sheet.js @@ -40,6 +40,35 @@ export class ArmyCohortSheetL5r5e extends ItemSheetL5r5e { } } + /** + * Activate a named TinyMCE text editor + * @param {string} name The named data field which the editor modifies. + * @param {object} options TinyMCE initialization options passed to TextEditor.create + * @param {string} initialContent Initial text content for the editor area. + * @override + */ + activateEditor(name, options = {}, initialContent = "") { + if (name === "data.abilities" && initialContent) { + initialContent = game.l5r5e.HelpersL5r5e.convertSymbols(initialContent, false); + } + super.activateEditor(name, options, initialContent); + } + + /** + * This method is called upon form submission after form data is validated + * @param event {Event} The initial triggering submission event + * @param formData {Object} The object of validated form data with which to update the object + * @returns {Promise} A Promise which resolves once the update operation has completed + * @override + */ + async _updateObject(event, formData) { + if (formData["data.abilities"]) { + // L5R Symbols + formData["data.abilities"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.abilities"], true); + } + return super._updateObject(event, formData); + } + /** * Subscribe to events from the sheet. * @param {jQuery} html HTML content of the sheet. diff --git a/system/templates/gm/monitor-tooltips/global-armies.html b/system/templates/gm/monitor-tooltips/global-armies.html index 59bdc0b..b003ae5 100644 --- a/system/templates/gm/monitor-tooltips/global-armies.html +++ b/system/templates/gm/monitor-tooltips/global-armies.html @@ -9,4 +9,13 @@
  • {{localize 'l5r5e.army.army_abilities'}} : {{actorData.army_abilities}}
  • {{{actorData.description}}}

    + + {{json actorData.items}} + + {{localize 'l5r5e.army.cohort.title'}} + \ No newline at end of file