From 791a98eb3c5795c6d1157b69b3a4f91a1844e604 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Sun, 3 Jan 2021 12:22:53 +0100 Subject: [PATCH] 20Q added a summary Some language refactoring Allow toggle even without editing perm Fix DnD on school rank with npc as they don't have it --- system/lang/en-en.json | 84 +++++----- system/lang/es-es.json | 84 +++++----- system/lang/fr-fr.json | 84 +++++----- system/scripts/actors/base-sheet.js | 22 ++- .../scripts/actors/twenty-questions-dialog.js | 29 +++- system/scripts/actors/twenty-questions.js | 52 ++++-- system/scripts/items/item-sheet.js | 14 +- .../actors/twenty-questions-dialog.html | 156 +++++++++++------- .../items/advancement/advancement-sheet.html | 2 +- .../items/property/property-entry.html | 2 +- 10 files changed, 308 insertions(+), 221 deletions(-) diff --git a/system/lang/en-en.json b/system/lang/en-en.json index d9cda64..582779b 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -300,82 +300,86 @@ "title": "Twenty questions", "bt_abrev": "20Q", "bt_refresh": "Refresh", - "intro": "You can use this sheet to fill in your answers to The Game of Twenty Questions, and to take notes for later!", - "section": "Legend of the Five Rings Core Rulebook, Chapter 2 : Creating a character, p. 41-95", - "incring1": "Ring increase (1)", - "incring2": "Ring increase (2)", - "incskill1": "Skill increases (1)", - "incskill2": "Skill increases (2)", - "incskill3": "Skill increases (3-5)", - "choosem": "Pick one", - "choosef": "Pick one", - "money": "Starting wealth in Koku :", - "glory": "Glory :", - "school": "School :", - "status": "Status", - "role": "Roles", - "access": "Technique types available", - "startech": "Starting techniques (2-5)", - "schoolab": "School ability", - "outfit": "Starting outfit", - "honor": "Honor", - "choogiri": "Select giri:", - "chooninjo": "Select ninjō:", + "increase_ring1": "Ring increase (1)", + "increase_ring2": "Ring increase (2)", + "increase_skill1": "Skill increases (1)", + "increase_skill2": "Skill increases (2)", + "increase_skill3": "Skill increases (3-5)", + "choose_one_ring": "Pick one", + "choose_one_skill": "Pick one", "or": "OR", - "incglory": "Glory increase", - "inchonor": "Honor increase", - "distinction": "Distinction (1)", - "adversity": "Adversity (1)", - "passion": "Passion (1)", - "anxiety": "Anxiety (1)", - "disadvant": "Disadvantage (1)", - "advant": "Advantage (1)", - "accoutr": "Personal accoutrement", - "object": "Item (Rarity 7 or lower)", - "d10r1": "D10 Result (1/2)", - "d10r2": "D10 Result (2/2)", - "generchar": "Generate the character", - "generchar_disclaimer": "Warning, this will erase character's current datas !", + "part0": { + "intro": "You can use this sheet to fill in your answers to The Game of Twenty Questions, and to take notes for later!", + "section": "Legend of the Five Rings Core Rulebook, Chapter 2 : Creating a character, p. 41-95" + }, "part1": { "title": "Part I: Core Identity (Clan and Family)", "q1": "1. What clan does your character belong to ? (p. 41)", - "q2": "2. What family does your character belong to ? (p. 49)" + "status": "Status", + "q2": "2. What family does your character belong to ? (p. 49)", + "money": "Starting wealth in Koku :", + "glory": "Glory :" }, "part2": { "title": "Part II: Role and School", "q3": "3. What is your character’s school, and what roles does that school fall into ? (p. 56)", + "school": "School :", + "role": "Roles", + "honor": "Honor", + "access": "Technique types available", + "school_ability": "School ability", + "starting_techniques": "Starting techniques (2-5)", + "outfit": "Starting outfit", "q4": "4. How does your character stand out within their school ? (p. 88)" }, "part3": { "title": "Part III: Honor and Glory", "q5": "5. Who is your lord and what is your character’s duty to them ? (p. 88)", + "choose_giri": "Select giri:", "q6": "6. What does your character long for, and how might this impede their duty ? (p. 90)", + "choose_ninjo": "Select ninjō:", "q7": "7. What is your character’s relationship with their clan ? (p. 91)", - "q8": "8. What does your character think of Bushidō ? (p. 91)" + "increase_glory": "Glory increase", + "q8": "8. What does your character think of Bushidō ? (p. 91)", + "increase_honor": "Honor increase" }, "part4": { "title": "Part IV: Strengths and Weaknesses", "q9": "9. What is your character’s greatest accomplishment so far ? (p. 92)", + "distinction": "Distinction (1)", "q10": "10. What holds your character back the most in life ? (p. 92)", + "adversity": "Adversity (1)", "q11": "11. What activity Most makes your character feel at peace ? (p. 93)", + "passion": "Passion (1)", "q12": "12. What concern, fear, or foible troubles your character the most ? (p. 93)", - "q13": "13. Who has your character learned the most from during their life (p. 93)" + "anxiety": "Anxiety (1)", + "q13": "13. Who has your character learned the most from during their life (p. 93)", + "disadvantage": "Disadvantage (1)", + "advantage": "Advantage (1)" }, "part5": { "title": "Part V: Personality and Behavior", "q14": "14. What do people notice first upon encountering your character? (p. 93)", + "accoutrement": "Personal accoutrement", "q15": "15. How does your character react to stressful situations ? (p. 94)", - "q16": "16. What are your character’s preexisting relationships with other clans, families, organizations, and traditions ? (p. 94)" + "q16": "16. What are your character’s preexisting relationships with other clans, families, organizations, and traditions ? (p. 94)", + "object": "Item (Rarity 7 or lower)" }, "part6": { "title": "Part VI: Ancestry and Family", "q17": "17. How would your character’s parents describe them ? (p. 95)", "q18": "18. Who was your character named to honor ? (p. 95)", + "d10r1": "D10 Result (1/2)", + "d10r2": "D10 Result (2/2)", "q19": "19. What is your character’s personal name ? (p. 95)" }, "part7": { "title": "Part VII: Death", - "q20": "20. How should your character die ? (p. 95)" + "q20": "20. How should your character die ? (p. 95)", + "summary": "Summary", + "generchar": "Generate the character", + "generchar_disclaimer": "Warning, this will erase character's current datas !", + "generchar_errors": "Clear errors before continuing !" } } } diff --git a/system/lang/es-es.json b/system/lang/es-es.json index f6935c6..a77c6ce 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -300,82 +300,86 @@ "title": "Twenty questions", "bt_abrev": "20Q", "bt_refresh": "Refresh", - "intro": "You can use this sheet to fill in your answers to The Game of Twenty Questions, and to take notes for later!", - "section": "Legend of the Five Rings Core Rulebook, Chapter 2 : Creating a character, p. 41-95", - "incring1": "Ring increase (1)", - "incring2": "Ring increase (2)", - "incskill1": "Skill increases (1)", - "incskill2": "Skill increases (2)", - "incskill3": "Skill increases (3-5)", - "choosem": "Pick one", - "choosef": "Pick one", - "money": "Starting wealth in Koku :", - "glory": "Glory :", - "school": "School :", - "status": "Status", - "role": "Roles", - "access": "Technique types available", - "startech": "Starting techniques (2-5)", - "schoolab": "School ability", - "outfit": "Starting outfit", - "honor": "Honor", - "choogiri": "Select giri:", - "chooninjo": "Select ninjō:", + "increase_ring1": "Ring increase (1)", + "increase_ring2": "Ring increase (2)", + "increase_skill1": "Skill increases (1)", + "increase_skill2": "Skill increases (2)", + "increase_skill3": "Skill increases (3-5)", + "choose_one_ring": "Pick one", + "choose_one_skill": "Pick one", "or": "OR", - "incglory": "Glory increase", - "inchonor": "Honor increase", - "distinction": "Distinction (1)", - "adversity": "Adversity (1)", - "passion": "Passion (1)", - "anxiety": "Anxiety (1)", - "disadvant": "Disadvantage (1)", - "advant": "Advantage (1)", - "accoutr": "Personal accoutrement", - "object": "Item (Rarity 7 or lower)", - "d10r1": "D10 Result (1/2)", - "d10r2": "D10 Result (2/2)", - "generchar": "Generate the character", - "generchar_disclaimer": "Warning, this will erase character's current datas !", + "part0": { + "intro": "You can use this sheet to fill in your answers to The Game of Twenty Questions, and to take notes for later!", + "section": "Legend of the Five Rings Core Rulebook, Chapter 2 : Creating a character, p. 41-95" + }, "part1": { "title": "Part I: Core Identity (Clan and Family)", "q1": "1. What clan does your character belong to ? (p. 41)", - "q2": "2. What family does your character belong to ? (p. 49)" + "status": "Status", + "q2": "2. What family does your character belong to ? (p. 49)", + "money": "Starting wealth in Koku :", + "glory": "Glory :" }, "part2": { "title": "Part II: Role and School", "q3": "3. What is your character’s school, and what roles does that school fall into ? (p. 56)", + "school": "School :", + "role": "Roles", + "honor": "Honor", + "access": "Technique types available", + "school_ability": "School ability", + "starting_techniques": "Starting techniques (2-5)", + "outfit": "Starting outfit", "q4": "4. How does your character stand out within their school ? (p. 88)" }, "part3": { "title": "Part III: Honor and Glory", "q5": "5. Who is your lord and what is your character’s duty to them ? (p. 88)", + "choose_giri": "Select giri:", "q6": "6. What does your character long for, and how might this impede their duty ? (p. 90)", + "choose_ninjo": "Select ninjō:", "q7": "7. What is your character’s relationship with their clan ? (p. 91)", - "q8": "8. What does your character think of Bushidō ? (p. 91)" + "increase_glory": "Glory increase", + "q8": "8. What does your character think of Bushidō ? (p. 91)", + "increase_honor": "Honor increase" }, "part4": { "title": "Part IV: Strengths and Weaknesses", "q9": "9. What is your character’s greatest accomplishment so far ? (p. 92)", + "distinction": "Distinction (1)", "q10": "10. What holds your character back the most in life ? (p. 92)", + "adversity": "Adversity (1)", "q11": "11. What activity Most makes your character feel at peace ? (p. 93)", + "passion": "Passion (1)", "q12": "12. What concern, fear, or foible troubles your character the most ? (p. 93)", - "q13": "13. Who has your character learned the most from during their life (p. 93)" + "anxiety": "Anxiety (1)", + "q13": "13. Who has your character learned the most from during their life (p. 93)", + "disadvantage": "Disadvantage (1)", + "advantage": "Advantage (1)" }, "part5": { "title": "Part V: Personality and Behavior", "q14": "14. What do people notice first upon encountering your character? (p. 93)", + "accoutrement": "Personal accoutrement", "q15": "15. How does your character react to stressful situations ? (p. 94)", - "q16": "16. What are your character’s preexisting relationships with other clans, families, organizations, and traditions ? (p. 94)" + "q16": "16. What are your character’s preexisting relationships with other clans, families, organizations, and traditions ? (p. 94)", + "object": "Item (Rarity 7 or lower)" }, "part6": { "title": "Part VI: Ancestry and Family", "q17": "17. How would your character’s parents describe them ? (p. 95)", "q18": "18. Who was your character named to honor ? (p. 95)", + "d10r1": "D10 Result (1/2)", + "d10r2": "D10 Result (2/2)", "q19": "19. What is your character’s personal name ? (p. 95)" }, "part7": { "title": "Part VII: Death", - "q20": "20. How should your character die ? (p. 95)" + "q20": "20. How should your character die ? (p. 95)", + "summary": "Summary", + "generchar": "Generate the character", + "generchar_disclaimer": "Warning, this will erase character's current datas !", + "generchar_errors": "Correct the errors before continuing !" } } } diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index 6ac19f0..e6184d3 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -300,82 +300,86 @@ "title": "Le jeu des Vingt questions", "bt_abrev": "20Q", "bt_refresh": "Actualiser", - "intro": "Renseignez vos réponses au jeu des vingt questions sur ce formulaire et notez-y des éléments à utiliser ultérieurement !", - "section": "Livre de Règles de La Légende des Cinq Anneaux, Chapitre 2 : Création de personnage, p. 41-95", - "incring1": "Augmentation d'anneau (1)", - "incring2": "Augmentations d'anneau (2)", - "incskill1": "Augmentation de compétence (1)", - "incskill2": "Augmentations de compétences (2)", - "incskill3": "Augmentations de compétences (3-5)", - "choosem": "En choisir un", - "choosef": "En choisir une", - "money": "Fortune de départ en Koku :", - "glory": "Gloire :", - "school": "École :", - "status": "Statut", - "role": "Rôles", - "access": "Types de techniques accessibles", - "startech": "Techniques de départ (2-5)", - "schoolab": "Capacité d'école", - "outfit": "Équipement de départ", - "honor": "Honneur", - "choogiri": "Choisissez un giri:", - "chooninjo": "Choisissez un ninjō:", + "increase_ring1": "Augmentation d'anneau (1)", + "increase_ring2": "Augmentations d'anneau (2)", + "increase_skill1": "Augmentation de compétence (1)", + "increase_skill2": "Augmentations de compétences (2)", + "increase_skill3": "Augmentations de compétences (3-5)", + "choose_one_ring": "En choisir un", + "choose_one_skill": "En choisir une", "or": "OU", - "incglory": "Augmentation de la gloire (+5)", - "inchonor": "Augmentation de l'honneur (+10)", - "distinction": "Aptitude (1)", - "adversity": "Coup du sort (1)", - "passion": "Passion (1)", - "anxiety": "Défaillance (1)", - "disadvant": "Désavantage (1)", - "advant": "Avantage (1)", - "accoutr": "Vêtement ou objet distinctif", - "object": "Objet (Rareté inférieur ou égale à 7)", - "d10r1": "Résultat du 1er D10", - "d10r2": "Résultat du 2eme D10", - "generchar": "Générer le personnage", - "generchar_disclaimer": "Attention cela écrasera les données de votre personnage actuel !", + "part0": { + "intro": "Renseignez vos réponses au jeu des vingt questions sur ce formulaire et notez-y des éléments à utiliser ultérieurement !", + "section": "Livre de Règles de La Légende des Cinq Anneaux, Chapitre 2 : Création de personnage, p. 41-95" + }, "part1": { "title": "Partie I: Identité (clan et famille)", "q1": "1. A quel clan appartient votre personnage ? (p. 41)", - "q2": "2. A quelle famille appartient votre personnage ? (p. 49)" + "status": "Statut", + "q2": "2. A quelle famille appartient votre personnage ? (p. 49)", + "money": "Fortune de départ en Koku :", + "glory": "Gloire :" }, "part2": { "title": "Partie II: Rôle et École", "q3": "3. Quelle est l'École votre personnage, et quel rôle remplit-elle ? (p. 56)", + "school": "École :", + "role": "Rôles", + "honor": "Honneur", + "access": "Types de techniques accessibles", + "school_ability": "Capacité d'école", + "starting_techniques": "Techniques de départ (2-5)", + "outfit": "Équipement de départ", "q4": "4. De quelle manière votre personnage se démarque-t-il au sein de son école ? (p. 88)" }, "part3": { "title": "Partie III: Honneur et Gloire", "q5": "5. Qui est le seigneur de votre personnage et quel est le devoir de votre personnage envers lui ? (p. 88)", + "choose_giri": "Choisissez un giri:", "q6": "6. Que désire votre personnage, et en quoi ce désir risque-t-il de l’empêcher d’accomplir son devoir ? (p. 90)", + "choose_ninjo": "Choisissez un ninjō:", "q7": "7. Quelle relation votre personnage entretient-il avec son clan ? (p. 91)", - "q8": "8. Que pense votre personnage du bushido ? (p. 91)" + "increase_glory": "Augmentation de la gloire (+5)", + "q8": "8. Que pense votre personnage du bushido ? (p. 91)", + "increase_honor": "Augmentation de l'honneur (+10)" }, "part4": { "title": "Partie IV: Forces et Faiblesses", "q9": "9. Quelle est à ce jour la plus belle réussite de votre personnage ? (p. 92)", + "distinction": "Aptitude (1)", "q10": "10. Quel est le frein principal dans la vie de votre personnage ? (p. 92)", + "adversity": "Coup du sort (1)", "q11": "11. Quelle activité apaise le plus votre personnage ? (p. 93)", + "passion": "Passion (1)", "q12": "12. Quelle inquiétude, crainte ou manie tracasse le plus votre personnage ? (p. 93)", - "q13": "13. De qui votre personnage a-t-il le plus appris au cours de sa vie ? (p. 93)" + "anxiety": "Défaillance (1)", + "q13": "13. De qui votre personnage a-t-il le plus appris au cours de sa vie ? (p. 93)", + "disadvantage": "Désavantage (1)", + "advantage": "Avantage (1)" }, "part5": { "title": "Partie V: Personnalité et Comportement", "q14": "14. Que remarque-t-on en premier chez votre personnage ? (p. 93)", + "accoutrement": "Vêtement ou objet distinctif", "q15": "15. Comment votre personnage réagit-il aux situations stressantes ? (p. 94)", - "q16": "16. Quelles relations votre personnage entretient-il avec des familles, des organisations, des traditions et des clans différents ? (p. 94)" + "q16": "16. Quelles relations votre personnage entretient-il avec des familles, des organisations, des traditions et des clans différents ? (p. 94)", + "object": "Objet (Rareté inférieur ou égale à 7)" }, "part6": { "title": "Partie VI: Lignée et Famille", "q17": "17. Comment les parents de votre personnage le décriraient-ils ? (p. 95)", "q18": "18. En l’honneur de qui votre personnage a-t-il été prénommé ? (p. 95)", + "d10r1": "Résultat du 1er D10", + "d10r2": "Résultat du 2eme D10", "q19": "19. Quel est le prénom de votre personnage ? (p. 95)" }, "part7": { "title": "Partie VII: Mort", - "q20": "20. Comment envisagez-vous la mort de votre personnage ? (p. 95)" + "q20": "20. Comment envisagez-vous la mort de votre personnage ? (p. 95)", + "summary": "Résumé", + "generchar": "Générer le personnage", + "generchar_disclaimer": "Attention cela écrasera les données de votre personnage actuel !", + "generchar_errors": "Corriger les erreurs pour poursuivre !" } } } diff --git a/system/scripts/actors/base-sheet.js b/system/scripts/actors/base-sheet.js index 5ab1b2e..8240ad7 100644 --- a/system/scripts/actors/base-sheet.js +++ b/system/scripts/actors/base-sheet.js @@ -109,7 +109,9 @@ export class BaseSheetL5r5e extends ActorSheet { case "advancement": // no break case "peculiarity": // Modify the bought at rank to the current actor rank - item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank; + if (this.actor.data.data.identity?.school_rank) { + item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank; + } break; case "technique": @@ -161,7 +163,9 @@ export class BaseSheetL5r5e extends ActorSheet { } // Modify the bought at rank to the current actor rank - item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank; + if (this.actor.data.data.identity?.school_rank) { + item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank; + } break; } @@ -180,6 +184,13 @@ export class BaseSheetL5r5e extends ActorSheet { activateListeners(html) { super.activateListeners(html); + // Toggle + html.find(".toggle-on-click").on("click", (event) => { + const elmt = $(event.currentTarget).data("toggle"); + const tgt = html.find("." + elmt); + tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active"); + }); + // *** Everything below here is only needed if the sheet is editable *** if (!this.options.editable) { return; @@ -201,13 +212,6 @@ export class BaseSheetL5r5e extends ActorSheet { event.target.select(); }); - // Toggle - html.find(".toggle-on-click").on("click", (event) => { - const elmt = $(event.currentTarget).data("toggle"); - const tgt = html.find("." + elmt); - tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active"); - }); - // *** Items : add, edit, delete *** html.find(".item-add").on("click", (event) => { this._addSubItem(event); diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index 3241bec..02466b1 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -13,9 +13,15 @@ export class TwentyQuestionsDialog extends FormApplication { actor = null; /** - * Errors + * Summary & Errors */ - errors = []; + summary = { + errors: [], + summary: { + rings: [], + skills: [], + }, + }; /** * Cache for items (techniques, adv...) @@ -68,7 +74,7 @@ export class TwentyQuestionsDialog extends FormApplication { super({}, options); this.actor = actor; this.object = new TwentyQuestions(actor); - this.errors = this.object.validateForm(); + this.summary = this.object.validateForm(); } /** @@ -124,8 +130,10 @@ export class TwentyQuestionsDialog extends FormApplication { techniquesList: CONFIG.l5r5e.techniques, data: this.object.data, cache: this.cache, - errors: this.errors.join(", "), - hasErrors: this.errors.length > 0, + summary: { + ...this.summary, + errors: this.summary.errors.join(", "), + }, }; } @@ -136,6 +144,13 @@ export class TwentyQuestionsDialog extends FormApplication { activateListeners(html) { super.activateListeners(html); + // Toggle + html.find(".toggle-on-click").on("click", (event) => { + const elmt = $(event.currentTarget).data("toggle"); + const tgt = html.find("." + elmt); + tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active"); + }); + // *** Everything below here is only needed if the sheet is editable *** if (!this.options.editable) { return; @@ -288,8 +303,8 @@ export class TwentyQuestionsDialog extends FormApplication { // Update 20Q object data this.object.updateFromForm(formData); - // Get errors if any - this.errors = this.object.validateForm(); + // Get errors if any, and redo summary table + this.summary = this.object.validateForm(); // Store this form datas in actor this.actor.data.data.twenty_questions = this.object.data; diff --git a/system/scripts/actors/twenty-questions.js b/system/scripts/actors/twenty-questions.js index e1ffe5e..47c3bbc 100644 --- a/system/scripts/actors/twenty-questions.js +++ b/system/scripts/actors/twenty-questions.js @@ -287,33 +287,56 @@ export class TwentyQuestions { } /** - * Return a array of errors, empty array if no errors founds + * Return summary and errors if any */ validateForm() { - const errors = []; + const out = { + errors: [], + summary: { + rings: [], + skills: [], + }, + }; // Rings & Skills, 3pt max for each - const rings = this._checkRingsOrSkills("ringList", 2); // ring start at 1 + const rings = this._summariesRingsOrSkills("ringList"); for (const key in rings) { - errors.push(`${game.i18n.localize("l5r5e.rings." + key)} (${rings[key]})`); + // ring start at 1 + rings[key] = rings[key] + 1; + const label = `${game.i18n.localize("l5r5e.rings." + key)} (${rings[key]})`; + if (rings[key] > 3) { + out.errors.push(label); + } + out.summary.rings.push(label); } - const skills = this._checkRingsOrSkills("skillList", 3); // skill start at 0 + const skills = this._summariesRingsOrSkills("skillList"); for (const key in skills) { - errors.push( - `${game.i18n.localize("l5r5e.skills." + CONFIG.l5r5e.skills.get(key) + "." + key)} (${skills[key]})` - ); + // skill start at 0 + const label = `${game.i18n.localize("l5r5e.skills." + CONFIG.l5r5e.skills.get(key) + "." + key)} (${ + skills[key] + })`; + if (rings[key] > 3) { + out.errors.push(label); + } + out.summary.skills.push(label); } - return errors; + out.summary.rings.sort((a, b) => { + return a.localeCompare(b); + }); + out.summary.skills.sort((a, b) => { + return a.localeCompare(b); + }); + + return out; } /** - * Return a list of exceeded ring/skill + * Return a list of ring/skill */ - _checkRingsOrSkills(listName, max) { + _summariesRingsOrSkills(listName) { const store = {}; - const exceed = {}; TwentyQuestions[listName].forEach((formName) => { const id = getProperty(this.data, formName); if (!id || id === "none") { @@ -323,10 +346,7 @@ export class TwentyQuestions { store[id] = 0; } store[id] = store[id] + 1; - if (store[id] > max) { - exceed[id] = store[id]; - } }); - return exceed; + return store; } } diff --git a/system/scripts/items/item-sheet.js b/system/scripts/items/item-sheet.js index c2ca79f..19ec495 100644 --- a/system/scripts/items/item-sheet.js +++ b/system/scripts/items/item-sheet.js @@ -83,6 +83,13 @@ export class ItemSheetL5r5e extends ItemSheet { activateListeners(html) { super.activateListeners(html); + // Toggle + html.find(".toggle-on-click").on("click", (event) => { + const elmt = $(event.currentTarget).data("toggle"); + const tgt = html.find("." + elmt); + tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active"); + }); + // Everything below here is only needed if the sheet is editable if (!this.options.editable) { return; @@ -93,13 +100,6 @@ export class ItemSheetL5r5e extends ItemSheet { event.target.select(); }); - // Toggle - html.find(".toggle-on-click").on("click", (event) => { - const elmt = $(event.currentTarget).data("toggle"); - const tgt = html.find("." + elmt); - tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active"); - }); - // Delete a property html.find(`.property-delete`).on("click", (event) => { const li = $(event.currentTarget).parents(".property"); diff --git a/system/templates/actors/twenty-questions-dialog.html b/system/templates/actors/twenty-questions-dialog.html index 657d0d3..d1e8171 100644 --- a/system/templates/actors/twenty-questions-dialog.html +++ b/system/templates/actors/twenty-questions-dialog.html @@ -1,6 +1,6 @@
- {{#if errors}} -
{{errors}}
+ {{#if summary.errors}} +
{{summary.errors}}
{{/if}}
@@ -18,9 +18,9 @@

{{localize 'l5r5e.twenty_questions.title'}}

- {{localize 'l5r5e.twenty_questions.intro'}} + {{localize 'l5r5e.twenty_questions.part0.intro'}}
-
{{localize 'l5r5e.twenty_questions.section'}} +
{{localize 'l5r5e.twenty_questions.part0.section'}}
@@ -35,11 +35,11 @@
@@ -433,7 +433,7 @@
- {{localize 'l5r5e.twenty_questions.adversity'}} + {{localize 'l5r5e.twenty_questions.part4.adversity'}}
{{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step10.adversity stepName='step10.adversity' itemType='peculiarities' hideDndAt=1 }} @@ -444,7 +444,7 @@
- {{localize 'l5r5e.twenty_questions.passion'}} + {{localize 'l5r5e.twenty_questions.part4.passion'}}
{{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step11.passion stepName='step11.passion' itemType='peculiarities' hideDndAt=1 }} @@ -455,7 +455,7 @@
- {{localize 'l5r5e.twenty_questions.anxiety'}} + {{localize 'l5r5e.twenty_questions.part4.anxiety'}}
{{> 'systems/l5r5e/templates/actors/character/twenty-questions-item.html' itemsList=cache.step12.anxiety stepName='step12.anxiety' itemType='peculiarities' hideDndAt=1 }} @@ -471,11 +471,11 @@