From 9538e44570ebc6c05c33110ada63aa57fd0b0fc1 Mon Sep 17 00:00:00 2001 From: jalensailin Date: Tue, 5 Dec 2023 17:00:24 -0500 Subject: [PATCH] dropdown for skills --- module/actor/actor-sheet.js | 25 ++++++++++++++++++++++ templates/actor/custom-skills-partial.html | 2 +- templates/dialog/special-training.html | 16 ++++++++++++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index a5ac4cf..29541ce 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -708,8 +708,33 @@ export default class DeltaGreenActorSheet extends ActorSheet { } async _showSpecialTrainingDialog(action, targetID) { + const specialTraining = this.actor.system.specialTraining.find( + (training) => training.id === targetID, + ); + + const skillList = Object.entries(this.actor.system.skills).map( + ([k, v]) => ({ + key: k, + label: v.label, + targetNumber: v.proficiency, + }), + ); + const typedSkillList = Object.values(this.actor.system.typedSkills).map( + (skill) => ({ + key: skill.label, + group: skill.group, + label: skill.label, + targetNumber: skill.proficiency, + }), + ); + const combinedSkillList = [...skillList, ...typedSkillList]; const content = await renderTemplate( "systems/deltagreen/templates/dialog/special-training.html", + { + name: specialTraining?.name || "", + currentSkill: specialTraining?.skill || "", + skillList: combinedSkillList, + }, ); const buttonLabel = game.i18n.localize( diff --git a/templates/actor/custom-skills-partial.html b/templates/actor/custom-skills-partial.html index 333795e..8b3263a 100644 --- a/templates/actor/custom-skills-partial.html +++ b/templates/actor/custom-skills-partial.html @@ -25,7 +25,7 @@ {{#each actor.system.specialTraining as |training|}}
diff --git a/templates/dialog/special-training.html b/templates/dialog/special-training.html index 24b893e..ce004e1 100644 --- a/templates/dialog/special-training.html +++ b/templates/dialog/special-training.html @@ -3,12 +3,24 @@ - +
- + {{#select currentSkill}} + + {{/select}}
\ No newline at end of file