fix tech sheet

This commit is contained in:
Vlyan
2023-03-15 15:01:40 +01:00
parent 823b883d4e
commit a24e775001
8 changed files with 81 additions and 46 deletions

View File

@@ -110,7 +110,7 @@ export class DicePickerDialog extends FormApplication {
* ex: new game.l5r5e.DicePickerDialog({skillId: 'aesthetics', ringId: 'water', actor: game.user.character}).render(true);
*
* Options :
* actor {Actor} Any `Actor` object instance. Ex : `game.user.character`, `canvas.tokens.controlled[0].actor`
* actor {ActorL5r5e} Any `Actor` object instance. Ex : `game.user.character`, `canvas.tokens.controlled[0].actor`
* actorId {string} This is the `id` not the `uuid` of an actor. Ex : "AbYgKrNwWeAxa9jT"
* actorName {string} Careful this is case-sensitive. Ex : "Isawa Aki"
* difficulty {number} `1` to `9`
@@ -274,19 +274,21 @@ export class DicePickerDialog extends FormApplication {
if (!skillsList) {
return;
}
this.object.skill.list = this.parseSkillsList(skillsList);
if (this.object.skill.list.length > 0) {
// Set 1st skill
if (this.useCategory) {
this.skillCatId = this.object.skill.list[0].id;
} else {
this.skillId = this.object.skill.list[0].id;
this.parseSkillsList(skillsList).then((list) => {
this.object.skill.list = list;
if (this.object.skill.list.length > 0) {
// Set 1st skill
if (this.useCategory) {
this.skillCatId = this.object.skill.list[0].id;
} else {
this.skillId = this.object.skill.list[0].id;
}
// Remove the list if only one item
if (this.object.skill.list.length === 1) {
this.object.skill.list = null;
}
}
// Remove the list if only one item
if (this.object.skill.list.length === 1) {
this.object.skill.list = null;
}
}
});
}
/**
@@ -833,10 +835,10 @@ export class DicePickerDialog extends FormApplication {
* NPC : shrink to category names
*
* @param {string} skillList
* @return {string[]}
* @returns {Promise<{id: *, label: string}[]>}
*/
parseSkillsList(skillList) {
const categories = game.l5r5e.HelpersL5r5e.getCategoriesSkillsList();
async parseSkillsList(skillList) {
const categories = await game.l5r5e.HelpersL5r5e.getCategoriesSkillsList();
// Sanitize and uniques values
const unqSkillList = new Set();